LeetCode-Two Sum

class Solution:
    # @return a tuple, (index1, index2)
    def twoSum(self,num, target):
        dict1={}
        for index,numbers in enumerate(num,1):
            minu=target-numbers
            if numbers in dict1:
                return dict1[numbers],index
            else:
                dict1[minu]=index

View comments.

more ...