209. Minimum Size Subarray Sum
Posted apanda009
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了209. Minimum Size Subarray Sum相关的知识,希望对你有一定的参考价值。
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的主要内容,如果未能解决你的问题,请参考以下文章
209. Minimum Size Subarray Sum
209. Minimum Size Subarray Sum
209. Minimum Size Subarray Sum
209. Minimum Size Subarray Sum