3ms || C++ || EASY || SIMPLE || TIME O(position of mst) || SPACE O(1)
\nclass Solution {\npublic:\n    int bitwiseComplement(int &n) {\n        if(n==0)return 1;\n        int ans = 0;\n        int i = 0;\n        while(n){\n      
```\nclass Solution {\npublic:\n    int bitwiseComplement(int &n) {\n        if(n==0)return 1;\n        int ans = 0;\n        int i = 0;\n        while(n){\n            ans += ((n%2)^1)<<i;\n            i++;\n            n = n >> 1;\n        }\n        return ans;\n    }\n};\n```
['Bit Manipulation', 'C', 'C++']