C++ solution faster than 100% of the solutions
\n# Code\n\nclass Solution {\npublic:\n    int bitwiseComplement(int n) {\n        int m = n ; \n        int mask = 0 ; \n        \n        while(m==0){\n      
\n# Code\n```\nclass Solution {\npublic:\n    int bitwiseComplement(int n) {\n        int m = n ; \n        int mask = 0 ; \n        \n        while(m==0){\n            return 1 ; \n        }\n        while(m!=0){\n            mask = ( mask << 1 ) | 1 ;\n            m = m >> 1 ; \n        }\n        int ans = (~n) & mask;\n            return ans ; \n    }\n};\n```
['C++']