How do I find duplicates in the list of lists in < n^2 in python? I cannot use a dictionary to do it in linear time as if I did with all standard types. I can only think of the following solution:
arr = [[1,2], [1,2,4], [1,2], [5,6], [8], [8]]
unique_arr = []
dups = []
for item in arr:
for item2 in unique_arr:
if (item == item2).all():
dups.append(item)
continue
unique_arr.append(item)
expected result for dups
is [[1,2], [8]]
Thanks