Created
October 7, 2017 18:27
-
-
Save dance2die/c50e88d09b7782b974f9f6e1bbdc0d87 to your computer and use it in GitHub Desktop.
Sung's implementation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static int Stray(int[] numbers) | |
{ | |
return numbers | |
.GroupBy(n => n) | |
.Select(g => new { Key = g.Key, Count = g.Count() }) | |
.Where(o => o.Count % 2 == 1).FirstOrDefault().Key; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment