For array [1,2,3,4,5], obviously, there is no sub array whose sum equal 11.
So I think there answer is 0.
consecutive sub array , right ?
@iryan This tripped me too.
The question has a typo it showed as: "Given an array of n positive integers and a positive integer s, find the minimal length of a contiguous subarray of which the sum ? s."
For the ? I assumed it was =. Oh well so much time wasted.
@administrators typo in the description, truly wasted my time
"Given an array of n positive integers and a positive integer s, find the minimal length of a contiguous subarray of which the sum ? s."
Please fix the typo @administrators, so that others may not waste their time like us!
@iryan said in I don't know how the case 11, [1,2,3,4,5] , expected answer is 3:
ought it's equa
And the example mislead me.
"For example, given the array [2,3,1,2,4,3] and s = 7,
the subarray [4,3] has the minimal length under the problem constraint."
Please add a example such as the subarraySum>s=7.