Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion 01_01/two_sum_stub.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
# 2-Sum Interview Problem

def two_sum_problem(arr, target):
pass
for i in range(len(arr) - 1, target):
for j in range(i + 1, len(arr)):
if arr[i] + arr[j] == target:
return i, j
return None


assert two_sum_problem([1, 2, 3], 4) in [(0, 2), (2, 0)]
Expand Down