[Leetcode]#1 Two Sum

时间:2019-01-11 18:32:35   收藏:0   阅读:156
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

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!