Skip to content

Commit

Permalink
Merge pull request soapyigu#275 from xieweiAlex/fix_typo_valid_vs_inv…
Browse files Browse the repository at this point in the history
…alid

[Array] Fix typo, should be valid instead of invalid
  • Loading branch information
soapyigu authored Jan 21, 2020
2 parents c65138d + 58361b1 commit ea7827a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Array/MinimumSizeSubarraySum.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Question Link: https://leetcode.com/problems/minimum-size-subarray-sum/
* Primary idea: Two Pointers, anchor the former and move forward the latter one to ensure the sum of subarray just covers the target
* Note: There could be no invalid subarray which sum >= target
* Note: There could be no valid subarray which sum >= target
* Time Complexity: O(n), Space Complexity: O(1)
*
*/
Expand All @@ -13,7 +13,7 @@
for (i, num) in nums.enumerated() {
currentSum += num

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

currentSum -= nums[start]
Expand All @@ -23,4 +23,4 @@

return miniSize == Int.max ? 0 : miniSize
}
}
}

0 comments on commit ea7827a

Please sign in to comment.