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.
1 parent f291ae8 commit 7863575Copy full SHA for 7863575
two-sum/yayyz.py
@@ -0,0 +1,8 @@
1
+class Solution:
2
+ def twoSum(self, nums: List[int], target: int) -> List[int]:
3
+ hashmap = {}
4
+ for i, num in enumerate(nums):
5
+ complement = target - num
6
+ if complement in hashmap:
7
+ return [hashmap[complement], i]
8
+ hashmap[num] = i
0 commit comments