209. Minimum Size Subarray Sum
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.
Example 1:
Example 2:
Example 3:
Constraints:
target
<= 109nums.length
<= 105nums[i]
<= 104Follow up: If you have figured out the O(n)
solution, try coding another solution of which the time complexity is O(n log(n))
.
一年多前寫過,現在寫還是錯了一次才過==
MarsgoatJul 6, 2023
JimJul 6, 2023
Yen-Chi ChenThu, Jul 6, 2023
Ron ChenThu, Jul 6, 2023