# Leetcode 209. Minimum Size Subarray Sum ## 題解 ### 滑動窗口 ```python! class Solution: def minSubArrayLen(self, target: int, nums: List[int]) -> int: n = len(nums) output = (10 ** 5) + 1 left = 0 sum = 0 for i in range(n): sum += nums[i] while sum >= target: output = min(output,i+1-left) sum -= nums[left] left += 1 return output if output != (10 ** 5) + 1 else 0 ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up