c++ solution ,beats 100%(0ms, 5MB)
class Solution {\npublic:\n    int bitwiseComplement(int n) {\n        \n        if(n==0)\n            return 1;\n        int countbits = floor(log2(n)) + 1;\n 
class Solution {\npublic:\n    int bitwiseComplement(int n) {\n        \n        if(n==0)\n            return 1;\n        int countbits = floor(log2(n)) + 1;\n        long long int temp = pow(2,countbits);\n        temp--;\n        long long int ans = n^temp;\n        return ans;\n    }\n};
[]