Separate nested list into groups with disjoint elements
问题 I have list of list that looks like this my_list = [[1, 2, 3, 4], [4, 5, 6, 7], [9, 10, 11, 12]] and I would like to find what's the best way to split the list into two groups so that the individual elements in each group are not overlapping. For instance, in the example above the two groups would be group1 = [[1, 2, 3, 4], [4, 5, 6, 7]] group2 = [[9, 10, 11, 12]] and this is because 9, 10, 11, 12 never appear in any of the items of group1 . 回答1: Similarly to Combine lists with common