Beats 100% || O(32) Time O(1) Space || Easy Explanation + Code
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```cpp []\nclass Solution {\npublic:\n    int findComplement(int num) {\n        int i = 0, ans = 0;\n        while (num) {\n            int temp = num & 1;\n            if (!temp)\n                ans += pow(2, i);\n            num = num >> 1;\n            i++;\n        }\n        return ans;\n    }\n};\n```
['C++']