Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .GroupBy(..., numbersGroup => numbersGroup.Key),
- .OrderByDescending(supergroup => supergroup.Key)
- .First()
- int[] numbers1 = { 1, 2, 3, 3, 2, 4 };
- // First in GroupBy(x => x) I group all numbers within the array (remove all duplicates too?), now my array looks like this [1,2,3,4].
- int[] result = numbers1.GroupBy(x => x)
- // In GroupBy(numbersGroup => numbersGroup.Count()) I collect all the different amount of occurrences withing the array, that would be 1 (1, 4) and 2 for (2, 4) so my array should look like this now [1, 2].
- // Now this is where things get out of hand, what happens at the rest of it? I have tried for 4 hours now and can't figure it out. What exactly happens in numbersGroup => numbersGroup.Key? .OrderByDescending(supergroup => supergroup.Key)?
- .GroupBy(numbersGroup => numbersGroup.Count(), numbersGroup => numbersGroup.Key)
- .OrderByDescending(supergroup => supergroup.Key)
- .First()
- .ToArray();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement