标签:length com nbsp mat log tps i++ solution subarray
https://leetcode.com/problems/minimum-size-subarray-sum/#/solutions
public int minSubArrayLen(int s, int[] a) { if (a == null || a.length == 0) return 0; int i = 0, j = 0, sum = 0, min = Integer.MAX_VALUE; while (j < a.length) { sum += a[j++]; while (sum >= s) { min = Math.min(min, j - i); sum -= a[i++]; } } return min == Integer.MAX_VALUE ? 0 : min; }
209. Minimum Size Subarray Sum
标签:length com nbsp mat log tps i++ solution subarray
原文地址:http://www.cnblogs.com/apanda009/p/7095780.html