QuestionGiven an array of positive integersnumsand a positive integertarget, returntheminimal lengthof asubarraywhose sum is greater than or equal totarget. If there is no such subarray, return0instead.Example 1:Input: target = 7, nums = [2,3,1,2,4,3]
Output: 2
Explanation: The subarray [4,3] has the minimal length under the problem constraint.Example 2:Input: target = 4, nums = [1,4,4]
Output: 1Example 3:Input: target = 11, nums = [1,1,1,1,1,1,1,1]
Output: 0AlgorithmThis question is a typical array question that leverage two pointers.You get the result in your one pass. Right pointer is the m
...
继续阅读
(15)