Microsoft Interview Question

Find the first duplicate in an unordered list

Interview Answer

Anonymous

Mar 19, 2018

list 1 = [1,4,1,2,3] list 2 =[] for i in list1: if i not in list2: list2.append(i) else print(i) print('first duplicate') break: