One line cpp solution with std::bit_xor


  • 0
    Y
        int singleNumber(vector<int>& nums) {
            return std::accumulate(nums.begin(), nums.end(), 0, std::bit_xor<int>())    ;
        }
    

Log in to reply
 

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