C++ 0ms solution using bitwise operation
The idea is to find the bit length of N, construct a string of 1\'s with the same length, and XOR with N.\n\nFor example, 5 in binary is 101. Notice that 101 ^ 
The idea is to find the bit length of N, construct a string of 1\'s with the same length, and XOR with N.\n\nFor example, 5 in binary is 101. Notice that 101 ^ 111 = 010 (2 in decimal).\n\n    int bitwiseComplement(int N) {\n        int comp = 1;\n        while (comp < N) \n            comp = (comp << 1) | 1;\n        return N ^ comp;\n    }\n\t
[]