Skip to content

Commit 14fe212

Browse files
committed
adding two sum
1 parent 8604eda commit 14fe212

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

two-sum/daiyongg-kim.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+
hash_map = {}
4+
for i, num in enumerate(nums):
5+
current = target - num
6+
if current in hash_map:
7+
return [hash_map[current], i]
8+
hash_map[num] = i
9+
return []
10+

0 commit comments

Comments
 (0)