public int minSubArrayLen(int s, int[] nums) {
        if (nums == null || nums.length == 0 || (nums.length == 1 && nums[0] < s))
            return 0;
        if (nums[0] >= s)
            return 1;
        int first = 0, second = 1, total = nums[0];
        int len = Integer.MAX_VALUE;
        while (second < nums.length) {
            total += nums[second];
            while (total >= s) {
                if (len > second - first + 1)
                    len = second - first + 1;
                total -= nums[first];
                ++first;
            }
            ++second;
        }
        if (len == Integer.MAX_VALUE)
            return 0;
        return len;
    }