having a List of int arrays like:
List intArrList = new List();
intArrList.Add(new int[3] { 0, 0, 0 });
intArrList.Add(new int[5] {
Input list;
List> initList = new List>();
initList.Add(new List{ 0, 0, 0 });
initList.Add(new List{ 20, 30, 10, 4, 6 }); //this
initList.Add(new List { 1, 2, 5 });
initList.Add(new List { 20, 30, 10, 4, 6 }); //this
initList.Add(new List { 12, 22, 54 });
initList.Add(new List { 1, 2, 6, 7, 8 });
initList.Add(new List { 0, 0, 0, 0 });
You can create a result list, and before adding elements you can check if it is already added. I simply compared the list counts and used p.Except(item).Any()
call to check if the list contains that element or not.
List> returnList = new List>();
foreach (var item in initList)
{
if (returnList.Where(p => !p.Except(item).Any() && !item.Except(p).Any()
&& p.Count() == item.Count() ).Count() == 0)
returnList.Add(item);
}