Python Solution


  • 0
    U

    class Solution(object):
    def twoSum(self, nums, target):
    for i,v in enumerate(nums):
    r=[i]
    p=i+1
    while p < len(nums):
    if v + nums[p] == target:
    r.append(p)
    break
    p+=1
    if len(r)==2:
    return r


Log in to reply
 

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