python find the duplicate number code example
Example 1: 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
Example 2: python check for duplicate
def checkDuplicate(user):
if len(set(user)) < len(user):
return True
return False