Skip to content

Commit 20b652f

Browse files
committed
two-sum
1 parent 2c2c8d2 commit 20b652f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

two-sum/Sung-Heon.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
class Solution:
2+
def twoSum(self, nums: List[int], target: int) -> List[int]:
3+
temp = {}
4+
for i, num in enumerate(nums):
5+
if target - num in temp:
6+
return [i, temp[target - num]]
7+
temp[num] = i
8+
return None

0 commit comments

Comments
 (0)