209. Minimum Size Subarray Sum
class Solution { public int minSubArrayLen(int s, int[] nums) { int i=0; int j=0; int len= Integer.MAX_VALUE; int sum=0; while(j<=nums.length) { if(sum<s&&j<nums.length) { sum+=nums[j]; j++; } else if(sum>=s) { len=Math.min(len, j-i); System.out.println(j-i); sum-=nums[i]; i++; } else break; } return len==Integer.MAX_VALUE?0:len; } }