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