Skip to content

Commit ea3cb48

Browse files
committed
two sum solution
1 parent 443cf68 commit ea3cb48

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

two-sum/JisuuungKim.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
class Solution:
2+
def twoSum(self, nums: List[int], target: int) -> List[int]:
3+
d = {}
4+
for i in range(len(nums)):
5+
cur = nums[i]
6+
x = target - cur
7+
if x in d:
8+
return [i, d[x]]
9+
else:
10+
d[cur] = i

0 commit comments

Comments
 (0)