209. Minimum Size Subarray Sum
class Solution:
def minSubArrayLen(self, target: int, nums: List[int]) -> int:
res = float('inf')
current = 0
l = 0
for i in range(len(nums)):
current += nums[i]
if current >= target:
while current - nums[l] >= target:
current -= nums[l]
l += 1
res = min(res, i - l + 1)
return 0 if res == float('inf') else res