[Leetcode]#1 Two Sum
阿新 • • 發佈:2019-01-11
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秒多也慘不忍睹了