You are viewing a single comment's thread. Return to all comments →
Really quick and simple solution using C#, sadly to my knowledge c# doesnt have a reduce function built in.. :(
static int lonelyinteger(int[] a) { List<int> occured = new List<int>(); foreach(int x in a){ if(!occured.Contains(x)){ occured.Add(x); } else { occured.Remove(x); } } return occured[0]; }
Seems like cookies are disabled on this browser, please enable them to open this website
Lonely Integer
You are viewing a single comment's thread. Return to all comments →
Really quick and simple solution using C#, sadly to my knowledge c# doesnt have a reduce function built in.. :(