I have a nested List as in the example:
List<List<int>> myList = new List<List<int>>();
myList.Add(new List<int> { 2, 7, 3 });
myList.Add(new List<int> { 4, 6});
myList.Add(new List<int> { 2, 5, 1 });
myList.Add(new List<int> { 7, 0, 2 });
myList.Add(new List<int> { 4, 9 });
我希望将所有至少有一个共同元素的列表合并,使输出成为一个List<List<int>>
,其中包含以下元素:
List<int> 2, 7, 3, 5, 1, 0
List<int> 4,6,9
谢谢你