[Leetcode]#1 Two Sum

class Solution:
    def twoSum(self, nums, target):
        """
        :type nums: List[int]
        :type target: int
        :rtype: List[int]
        """

        for index1 in range(len(nums)):
            for index2 in range(index1 + 1, len(nums)):
                if nums[index1] + nums[index2] == target:
                    return [index1, index2]

 

 

 

还以为必然timeout 结果并没有 不过7秒多也惨不忍睹了

posted @ 2019-01-11 18:16  夜歌乘年少  阅读(126)  评论(0编辑  收藏  举报