Skip to content

Commit ea7827a

Browse files
authored
Merge pull request soapyigu#275 from xieweiAlex/fix_typo_valid_vs_invalid
[Array] Fix typo, should be valid instead of invalid
2 parents c65138d + 58361b1 commit ea7827a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Array/MinimumSizeSubarraySum.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* Question Link: https://leetcode.com/problems/minimum-size-subarray-sum/
33
* Primary idea: Two Pointers, anchor the former and move forward the latter one to ensure the sum of subarray just covers the target
4-
* Note: There could be no invalid subarray which sum >= target
4+
* Note: There could be no valid subarray which sum >= target
55
* Time Complexity: O(n), Space Complexity: O(1)
66
*
77
*/
@@ -13,7 +13,7 @@
1313
for (i, num) in nums.enumerated() {
1414
currentSum += num
1515

16-
while currentSum >= s && start <= i {
16+
while currentSum >= s, start <= i {
1717
miniSize = min(miniSize, i - start + 1)
1818

1919
currentSum -= nums[start]
@@ -23,4 +23,4 @@
2323

2424
return miniSize == Int.max ? 0 : miniSize
2525
}
26-
}
26+
}

0 commit comments

Comments
 (0)