运用穷举法
class Solution(object):
def twoSum(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: List[int]
"""
for i in range(len(nums)):
for j in range(len(nums)):
if i==j:
pass
elif nums[i]+nums[j]==target:
return i,j
c=Solution()
nums=[1,3,4,5]
target=9
print(c.twoSum(nums,target))