python find first duplicate numbers

Solutions on MaxInterview for python find first duplicate numbers by the best coders in the world

showing results for - "python find first duplicate numbers"
Federica
17 Apr 2018
1def findDuplicateNumbers(a):
2  mySet = set()
3    for el in a:
4        if el in mySet:
5            return el
6        mySet.add(el)
7    return -1