2026-08-25 19:14:07 -06:00

21 lines
310 B
Python

nums = [2, 7, 11, 15]
target = 26
def twoSum(nums, target):
length = len(nums)
for i in range(0, length):
for j in range(i+1, length):
if nums[i] + nums[j] == target:
return (i, j)
break
j=j+1
res = twoSum(nums, target)
print res