c++ solution using accumulate


  • 1
    G
    class Solution {
    public:
        int singleNumber(vector<int>& nums) {
            return accumulate(nums.begin(), nums.end(), 0, bit_xor<int>());
        }
    };
    

Log in to reply
 

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