Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit ecb64bf

Browse files
author
Khanh Do
committed
Fix space complexity reasoning
1 parent 4500068 commit ecb64bf

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

0001-two-sum.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def two_sum2(nums, target):
2323
Can assume that each input has exactly one solution.
2424
2525
Time: O(n) -- loop through the array once; past dict get/set is O(1)
26-
Space: O(n) -- might have to store all n elements in past dict
26+
Space: O(n) -- might have to store n-1 elements in past dict for a solution
2727
"""
2828
if len(nums) < 2:
2929
return [None, None]

0 commit comments

Comments
 (0)