3 lines of C++ solution


  • 0
    W

    class Solution {
    public:
    int singleNumber(vector<int>& nums) {
    int result=0;
    for(int n:nums) result^=n;
    return result;
    }
    };


Log in to reply
 

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