首页 > 其他 > 详细

[Leetcode]#1 Two Sum

时间:2019-01-11 18:32:35      阅读:153      评论:0      收藏:0      [点我收藏+]
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秒多也惨不忍睹了

[Leetcode]#1 Two Sum

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!