解决思路:
1.求两个列表的交集
2.遍历交集列表中的每一个元素,min(元素在列表1中的次数,元素在列表2次数),就是此元素的重叠次数
3.返回元素,最大重叠次数
def max_overlap(list1,list2):
overlap = set(list1).intersection(list2)
ox = [(x,min(list1.count(x),list2.count(x))) for x in overlap]
return max(ox,key=lambda x: x[1])
print(max_overlap([1, 2, 2, 2, 3, 3], [2, 2, 3, 2, 2, 3]))