两数之和-

class Solution(object):
    def twoSum(self, nums, target):
        for i in range(len(nums)):
            a=[]
            for j in range(i+1,len(nums)):
                if nums[j]==target-nums[i]:
                    a.append(i)
                    a.append(j)
                    return a

你可能感兴趣的:(算法,leetcode,数据结构)