209.Minimum Size Subarray Sum Posted on 2017-09-13 | In LeetCode Solution 1: accepted 3msTwo pointers. 1234567891011121314151617181920class Solution { public int minSubArrayLen(int s, int[] nums) { int start = 0; int end = 0; int sum = 0; int min = Integer.MAX_VALUE; for (int i = 0; i < nums.length; i++) { sum += nums[i]; end = i; if (sum >= s) { while (sum - nums[start] >= s) { sum -= nums[start]; start++; } min = Math.min(min, end - start + 1); } } return min == Integer.MAX_VALUE ? 0 : min; }}