Chocolate in Box Discussions | Algorithms | HackerRank
  • + 0 comments

    C#:

    public static int chocolateInBox(List<int> arr)
    {
        int trs = arr.Aggregate(0, (xor, cur) => xor ^ cur);
        return arr.Where(a=>a > 0 && (a ^ trs) < a).Count();
    }
    

    ...actually 2 lines