XOR all elements


  • -1
    J
        int singleNonDuplicate(vector<int>& nums) {
            return accumulate(nums.begin(), nums.end(), 0, [] (int init, int a) { return init ^ a;});
        }
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.