public static List<Tuple<int, int>> GetCountOfLength(List<int> list)
{
List<Tuple<int, int>> res = new List<Tuple<int, int>>();
foreach (var el in list) res.Add(Tuple.Create(list.Where(e0 => e0 == el).Count(), el));
res.Sort();
return res;
}
Input param - list for examp1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 3 3 3 3 3 3 4 5 5 5 5 5 6 6 6 6 6 6 890 890
And the result must be 1 - 13;2 -7;3 - 6;5 - 5;6 -6
But as a result I always have
1 1
1 2
1 3
and etc.
What is wrong?


Sign In
Create Account

Back to top









