@@ -0,0 +1,1049 @@
+/**%0A * Given an array of n positive integers and a positive integer s, find the minimal length of a subarray of which the sum %E2%89%A5 s. If there isn't one, return 0 instead.%0A * For example, given the array %5B2,3,1,2,4,3%5D and s = 7, the subarray %5B4,3%5D has the minimal length under the problem constraint.%0A * @author Jun%0A *%0A */%0A %0A public class Solution %7B%0A    public int minSubArrayLen(int s, int%5B%5D nums) %7B%0A    %09if(nums == null %7C%7C nums.length == 0) return 0;%0A    %09int i = 0, j = 0, sum = 0, result = 0;%0A    %09while(j %3C nums.length && sum %3C s)%0A    %09%09sum += nums%5Bj++%5D;%0A    %09// window size is initialized as the number of first elements whose sum %3E= s %0A    %09int wdSize = j;%0A    %09j--;%0A    %09%0A     %09while(j %3C nums.length) %7B%0A    %09%09if(sum %3E= s) %7B%0A    %09%09%09if(i == j) return 1;%0A    %09%09%09result = wdSize;%0A    %09%09%09// try to find subarrays with shorter length%0A    %09%09%09wdSize--;%0A    %09%09%09sum -= nums%5Bi++%5D;%0A    %09%09%7D else %7B%0A    %09%09%09// slide window to right%0A    %09%09%09if(j == nums.length - 1) break;%0A    %09%09%09sum = sum - nums%5Bi++%5D + nums%5B++j%5D;%0A    %09%09%7D%0A    %09%7D%0A        return result;%0A    %7D%0A%7D%0A

Create 209.java