Skip to content

Commit b35df75

Browse files
committed
Merge branch 'interview' of https://github.com/hiiamkarati/Python-A2Z into interview
2 parents a075bfc + c3e20ba commit b35df75

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

interview-bootcamp/Two-Sum.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,17 @@ def two_sum(nums: list[int], target: int) -> tuple[int, int] | None:
88
"""
99
num_set = set()
1010

11+
1112
for num in nums:
1213
complement = target - num
1314
if complement in num_set:
1415
return (complement, num)
1516
num_set.add(num)
1617

18+
1719
return None
1820

1921

22+
2023
if __name__ == "__main__":
2124
print(two_sum([2, 7, 11, 15], 9))

0 commit comments

Comments
 (0)