如何在Python中找到$n^2$以下的列表中的重复项? 我不能像对于所有标准类型那样使用字典以线性时间完成。 我只能想到以下解决方案:
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)
dups
期望的结果为 [[1,2], [8]]
谢谢