I need to find all value that are present in all sublist of a larger list (they are all ids)
What I have tried is first getting all uniques values present in all list and they test each value but this is extremly slow on a big list
l1 = ["a", "b", "c", "d", "e", "f"]
l2 = ["b", "c", "e", "f", "g"]
l3 = [ "b", "c", "d", "e", "f", "h"]
LL = [l1, l2, l3]
LL
unique_ids = set(x for l in LL for x in l)
filter_id = []
lenList = len(LL)
for id in unique_ids:
if sum(id in item for item in LL) == lenList:
filter_id.append(id)
How could I speed up the search ?