Minimum Size Subarray Sum
Given an array ofnpositive integers and a positive integers, find the minimal length of acontiguoussubarray of which the sum ≥s. If there isn't one, return 0 instead.
For example, given the array[2,3,1,2,4,3]
ands = 7
,
the subarray[4,3]
has the minimal length under the problem constraint.
分析
窗口类指针。for i loop里直接跟上while j 的条件,i,j无需错开,开始直接相等。
python
Last updated