4 lines python solution


  • 0
    P
        def twoSum(self, numbers, target):
            l = [0, 1]
            while numbers[l[0]]+numbers[-1*l[1]]!=target:
                l[numbers[l[0]]+numbers[-1*l[1]]>target] += 1
            return [l[0]+1,len(numbers)-l[1]+1]
                ````

Log in to reply
 

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