c++ Solution using Bitwise ^ (Beats 100%)
XOR of any Number with a number having all bit 1 gives Binary complemented number.\nEg- 101 ^ 111 = 010 \n\n\nclass Solution {\npublic:\n    int bitwiseCompleme
XOR of any Number with a number having all bit 1 gives Binary complemented number.\nEg- 101 ^ 111 = 010 \n\n```\nclass Solution {\npublic:\n    int bitwiseComplement(int N) {\n \n        if(N==0)\n            return 1;\n        int p=log2(N);\n\t\t\t\tlong num=pow(2,p+1)-1;  //  num has all bit 1;\n        \n        return N^num;\n    }\n};\n\n\n```
[]