Easy C++
Thought process is that you have to keep one number shift to left until it can no longer be shifted. At the same time, you can right shift by 1 for a number i a
Thought process is that you have to keep one number shift to left until it can no longer be shifted. At the same time, you can right shift by 1 for a number i and take the XOR, which leads to the opposite complement.\n\n```\nclass Solution {\npublic:\n    int findComplement(int num) {\n        int copy = num;\n        int i = 0;\n\n        while(copy != 0) {\n            copy >>= 1;\n            num ^= (1<<i);\n            i += 1;\n        }\n        return num;\n    }\n};\n```
['Bit Manipulation', 'C']