Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

first duplicate

def solution(a):
    
    arr = []
    
    for i in range(len(a)):
        for j in range(i+1,len(a)):
            if a[i]==a[j]:
                hash.append(j)
    if len(hash) == 0:
        return -1
    else:
        idx = min(hash)
        return a[idx]

a = [2, 3, 4, 6, 5, 3]
Solution(a)
 
PREVIOUS NEXT
Tagged: #duplicate
ADD COMMENT
Topic
Name
3+5 =