Skip to content

Commit 718ae73

Browse files
committed
problem solution & test 0008
1 parent 502b816 commit 718ae73

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

solutions/minimum_size_subarray_sum_0209.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
class Solution:
22
def minSubArrayLen(self, target: int, nums: list[int]) -> int:
3+
"""
4+
Given an array of positive integers nums and a positive integer target,
5+
return the minimal length of a contiguous subarray of which the sum is
6+
greater than or equal to target.
7+
If there is no such subarray, return 0.
8+
"""
39
left_mark, current_sum, min_length = 0, 0, float('inf')
410
for right_mark in range(len(nums)):
511
current_sum += nums[right_mark]

0 commit comments

Comments
 (0)