Posted on:

20 Nov 2022

0

My solution. Without Dictionary but is it bruteforce or efficient one?

def two_sum2(lst, target):
    for i in range(len(lst)):
        if target - lst[i] in lst[i+1:]:
            return (lst.index(lst[i]), lst.index(target-lst[i]))
    return -1
0 answers ( 0 marked as helpful)

Submit an answer