You are viewing a single comment's thread. Return to all comments →
In C#:
List<int> arr=new List<int>(); foreach(int i in a) { arr.Add(i); } arr.Sort(); int lonely=0; if(arr.Count==1) { return arr[0]; } for(int i=1;i<arr.Count-1;i++) { if(arr[i-1]!=arr[i] && arr[i+1]!=arr[i] ) { return arr[i]; } } if(arr[0]!=arr[1]) return arr[0]; else return arr[arr.Count-1];
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 →
In C#: