One line in Java


  • 0
    W

    public int findComplement(int num) {
    return Integer.highestOneBit(num) - 1 - (num - Integer.highestOneBit(num));
    }


Log in to reply
 

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