LeetCode——1两数之和
求两个数字之和等于target
class Solution:
def twoSum(self, nums: List[int], target: int) -> List[int]:
result = list()
for i in range(len(nums)):
for j in range(i+1, len(nums)):
if i != j and (nums[i]+nums[j]) == target:
result.append(i)
result.append(j)
return result