✔️ [Python3] SHIFT AND XOR (ᕗ ͠° ਊ ͠° )ᕗ, Explained
We create a mask=1 and shift its bit to the left until it gets greater than n. Example: n=101 => mask=1000. After, we substruct 1 from the mask which gives us a
We create a mask=`1` and shift its bit to the left until it gets greater than `n`. Example: `n=101` => `mask=1000`. After, we substruct `1` from the mask which gives us all `1`\'s:  `mask=111`. And the last step, we simply return xor between `n` and our mask: `n ^ mask` = `101 ^ 111` = `010`.\n\nTime: **O(1)** - since number of bits to scan are limited\nSpace: **O(1)** - nothing stored\n\nRuntime: 24 ms, faster than **94.01%** of Python3 online submissions for Complement of Base 10 Integer.\nMemory Usage: 14.1 MB, less than **89.54%** of Python3 online submissions for Complement of Base 10 Integer.\n\n```\nclass Solution:\n    def bitwiseComplement(self, n: int) -> int:\n        if not n: return 1\n        \n        mask = 1\n        while n >= mask:\n            mask <<= 1\n            \n        return (mask - 1) ^ n\n```
['Python3']