Skip to content

Instantly share code, notes, and snippets.

@dance2die
Created October 7, 2017 18:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dance2die/c50e88d09b7782b974f9f6e1bbdc0d87 to your computer and use it in GitHub Desktop.
Save dance2die/c50e88d09b7782b974f9f6e1bbdc0d87 to your computer and use it in GitHub Desktop.
Sung's implementation
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