6-lines Python solution


  • 0
    Z
    for v in nums:
                k=nums.index(v)
                j=[i for i,t in enumerate(nums) if t==target-v]
                if len(j)>0:
                    j=j[-1]
                    if k<j:return [k,j]
    

Log in to reply
 

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