C 3MS beat 15.69%


  • 0
    L
    int findComplement(int num) {
        
        int result=num^0xffffffff;
        int i=31;
        
        while(result&(1<<i))
        {
            result^=(1<<i);
            --i;
        }
        
        return result;
    }
    

Log in to reply
 

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