Why doesn't this work?


  • 0
    H

    Obviously isn't ideal, but this should work right? Works when I run it locally.

    class Solution(object):
        def twoSum(self, nums, target):
            """
            :type nums: List[int]
            :type target: int
            :rtype: List[int]
            """
            for i in xrange(0, len(nums)-1):
                for j in xrange(i+1, len(nums)-1):
                    print j
                    if nums[i] + nums[j] == target:
                        return [i,j]
    

    What am I missing?


  • 0
    H

    Nevermind I'm an idiot :(


Log in to reply
 

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