My Answer by Python 60ms

  • 0
    class Solution:
    # @return a tuple, (index1, index2)
    def twoSum(self, num, target):
        target_dict=dict((val,index+1) for index,val in enumerate(num))
        for (i,v) in enumerate(num):
            if index and index!=i+1:
                return (i+1,index)

Log in to reply

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