first duplicates in array python code example
Example: python find first duplicate numbers
def findDuplicateNumbers(a):
mySet = set()
for el in a:
if el in mySet:
return el
mySet.add(el)
return -1
def findDuplicateNumbers(a):
mySet = set()
for el in a:
if el in mySet:
return el
mySet.add(el)
return -1