C++ simple 3 lines 3ms solution


  • 0
    int findComplement(int num) {
            int temp=num,i=1;
            while(temp) num=num^i,temp>>=1,i<<=1;
            return num;
        }
    

Log in to reply
 

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