python solution 42ms


  • 0
    A

    reference to wz2326's code "Clean 16ms C++ Solution",I completed my python code

            dic = {}
            for i in range(len(nums)):
                select = dic.get(target - nums[i])
                if(select != None):
                    return [select, i]
                dic[nums[i]] = i
    

Log in to reply
 

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