15 lines
463 B
Python
15 lines
463 B
Python
def twoSum(nums, target):
|
|
"""
|
|
:type nums: List[int]
|
|
:type target: int
|
|
:rtype: List[int]
|
|
"""
|
|
for i in range(len(nums)):
|
|
for j in range(i+1, len(nums)):
|
|
if nums[i] + nums[j] == target:
|
|
#print(f'i is {nums[i]}, j is {nums[j]}')
|
|
return [i,j]
|
|
|
|
|
|
print(twoSum([2,7,11,15], 9))
|
|
print(twoSum([3,2,4], 6)) |