What is the best way to find the duplicates in a list of a list of integers (no matter what position thay are in)? I don't necessary need code just the best way to go about this problem (in C#).
eg:
List<List<int>> TestData = new List<List<int>>
{
new List<int> { 1, 2, 3 },
new List<int> { 2, 1, 3 },
new List<int> { 6, 8, 3, 45,48 },
new List<int> { 9, 2, 4 },
new List<int> { 9, 2, 4, 15 },
};
The idea is that this will return
Count | Set
----------------
2x | 1,2,3
1x | 6, 8, 3, 45, 48
1x | 9,2,4
1x | 9, 2, 4, 15
I've been breaking my head over this seemingly very simple question but for some reason I can't figure it out. Hope someone is able to help, Like I said code not necessary but greatly appreciated.
well, first you want to convert your lists to sets,
then you can groups the sets for equality.
Here is a fully working example,