Skip to content

Commit 458da18

Browse files
committed
Sync LeetCode submission Runtime - 40 ms (96.74%), Memory - 38.1 MB (12.61%)
1 parent c42a4ab commit 458da18

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

0523-continuous-subarray-sum/solution.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
# Approach 1: Prefix Sum and Hashing
1+
# Approach 1: Prefix sum and Hashing
22

33
# Time: O(n)
44
# Space: O(n)
55

66
class Solution:
77
def checkSubarraySum(self, nums: List[int], k: int) -> bool:
88
prefix_mod = 0
9-
mod_seen = {0: -1}
10-
9+
mod_seen = {0 : -1}
10+
1111
for i in range(len(nums)):
1212
prefix_mod = (prefix_mod + nums[i]) % k
1313

@@ -20,3 +20,4 @@ def checkSubarraySum(self, nums: List[int], k: int) -> bool:
2020
mod_seen[prefix_mod] = i
2121

2222
return False
23+

0 commit comments

Comments
 (0)