[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秒多也惨不忍睹了

原文地址:https://www.cnblogs.com/alfredsun/p/10256627.html