easy solution | beats 100%
Approach\n1. If the input number is 0, return 1 as the bitwise complement of 0 is 1.\n2. Determine the number of bits required to represent the input number by 
# Approach\n1. If the input number is 0, return 1 as the bitwise complement of 0 is 1.\n2. Determine the number of bits required to represent the input number by counting the number of shifts needed until the number becomes 0.\n3. Create a mask with all bits set to 1 using the formula \\(2^i - 1\\), where \\(i\\) is the number of bits.\n4. Compute the bitwise complement by performing a bitwise NOT operation on the input number and applying the mask.\n\n# Complexity\n- Time complexity: $$O(\\log n)$$, where \\(n\\) is the input number.\n- Space complexity: $$O(1)$$\n\n# Code\n```cpp\nclass Solution {\npublic:\n    int bitwiseComplement(int n) {\n        if (n == 0) return 1;\n        int i = 0, num = n;\n        while (num) {\n            i++;\n            num >>= 1;\n        }\n        int mask = pow(2, i) - 1;\n        return ((~n) & mask);\n    }\n};\n```
['Bit Manipulation', 'C++']