Simple Python Solution || O(logN)
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```\nclass Solution:\n    def bitwiseComplement(self, n: int) -> int:\n        s=bin(n)[2:]\n        arr=\'\'\n        for i in s:\n            if i==\'0\':\n                arr+=\'1\'\n            else:\n                arr+=\'0\' \n        res=0\n        for i in range(len(arr)-1,-1,-1):\n            res=res+(int(arr[i])* 2**(len(arr)-i-1))\n        return res\n```
['Python3']