LeetcodeCN: 209 - Minimum Size Subarray Sum
Question: Given an array of positive integers nums and a positive integer target, return the minimal length of a subarray whose sum is greater than or equal to target. If there is no such subarray, return 0 instead.
Solution:

我再加多一句。如果当前的数组的和本来就不足target,那么它的任何相邻子数组都不满足要求——反之则可能。

浙公网安备 33010602011771号