Lonely Integer

  • + 0 comments

    in C# public static int lonelyinteger(List a) {

    var cc = a.GroupBy(x => x).ToDictionary(g => g.Key, g => g.ToList());
    var dd = cc.Where(x => x.Value.Count == 1).ToList();
    return dd[0].Key;
    

    }