We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents c65138d + 58361b1 commit ea7827aCopy full SHA for ea7827a
Array/MinimumSizeSubarraySum.swift
@@ -1,7 +1,7 @@
1
/**
2
* Question Link: https://leetcode.com/problems/minimum-size-subarray-sum/
3
* 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
+ * Note: There could be no valid subarray which sum >= target
5
* Time Complexity: O(n), Space Complexity: O(1)
6
*
7
*/
@@ -13,7 +13,7 @@
13
for (i, num) in nums.enumerated() {
14
currentSum += num
15
16
- while currentSum >= s && start <= i {
+ while currentSum >= s, start <= i {
17
miniSize = min(miniSize, i - start + 1)
18
19
currentSum -= nums[start]
@@ -23,4 +23,4 @@
23
24
return miniSize == Int.max ? 0 : miniSize
25
}
26
-}
+}
0 commit comments