var minSubArrayLen = function(target, nums) {
let counter = Infinity;
let start = 0;
let sum = 0;
for (let i = 0; i < nums.length; i++) {
sum= sum + nums[i];
while(sum>=target){
counter = Math.min(counter, i-start +1)
sum= sum - nums[start];
start++;
}
}
if(counter === Infinity){
return 0;
}
return counter;
};
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (0)