Python Accepted code


  • 0
    M
    class Solution(object):
        def twoSum(self, nums, target):
    
            for i in range(0,len(nums)-1):
    
                x = i + 1
                while x <= len(nums)-1:
    
    
                    if nums[i] + nums[x] == target:
    
                        print "Founded!, Pointers: ", i,x, "Numbers: ", nums[i] , nums[x]
                        exit(0)
                    elif x == len(nums) :
                        break
    
                    else:
                        x += 1
    
    

Log in to reply
 

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