How to get the 36ms python solution?

  • 0

    My solution is easy but get 48ms the best runtime

    class Solution(object):
        def twoSum(self, nums, target):
            :type nums: List[int]
            :type target: int
            :rtype: List[int]
            hash = {}
            for i, num in enumerate(nums):
                if num in hash:
                    return [hash[num], i]
                hash[target-num] = i

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.