Skip to content

Commit

Permalink
Time: 55 ms (87.65%) | Memory: 17.6 MB (74.46%) - LeetSync
Browse files Browse the repository at this point in the history
  • Loading branch information
ShatilKhan committed Feb 6, 2024
1 parent cac1019 commit 36fb9d7
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions 1-two-sum/two-sum.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from typing import List

class Solution:
def twoSum(self, nums: List[int], target: int) -> List[int]:
num_map = {}
for i, num in enumerate(nums):
diff = target - num
if diff in num_map:
return [num_map[diff], i]
num_map[num] = i
return []

0 comments on commit 36fb9d7

Please sign in to comment.