This commit is contained in:
2026-05-25 12:29:20 +05:00
parent 9d30fc897c
commit ec7f45e03a
4 changed files with 102 additions and 0 deletions

9
solutions/lc1.py Normal file
View File

@@ -0,0 +1,9 @@
class Solution:
def twoSum(self, nums: List[int], target: int) -> List[int]:
seen = {}
for i, x in enumerate(nums):
need = target - x
if need in seen:
return [seen[need], i]
seen[x] = i