1. 程式人生 > >[Leetcode]#1 Two Sum

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