Skip to content

Commit 6dc68e4

Browse files
two sum
1 parent bc4865c commit 6dc68e4

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

two-sum/deepInTheWoodz.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+
passed = dict()
4+
5+
for i, num in enumerate(nums):
6+
other = target - num
7+
if other in passed:
8+
return [passed[other], i]
9+
passed[num] = i
10+

0 commit comments

Comments
 (0)