C solution using xor


  • 0
    N
    int singleNonDuplicate(int* nums, int numsSize) {
        int i,xor=0;
        for(i=0;i<numsSize;i++){
            xor= xor^nums[i];
        }
        return xor;
    }
    

Log in to reply
 

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