One line solutions
\nclass Solution:\n    def findComplement(self, num: int) -> int:\n        return num ^ ((1 << num.bit_length()) - 1)\n\n\nclass Solution:\n    def findCompleme
```\nclass Solution:\n    def findComplement(self, num: int) -> int:\n        return num ^ ((1 << num.bit_length()) - 1)\n```\n```\nclass Solution:\n    def findComplement(self, num: int) -> int:\n        return num ^ (2 ** num.bit_length() - 1)\n```\n```\nclass Solution:\n    def findComplement(self, num: int) -> int:\n        return num ^ reduce(lambda n, i: n | n >> i, (1, 2, 4, 8, 16), num)\n```\n\n```\nclass Solution:\n    def findComplement(self, num: int) -> int:   \n        return num ^ next(m-1 for m in accumulate(repeat(1), lshift, initial=1) if num < m)\n```\n```\nclass Solution:\n    def findComplement(self, num: int) -> int:\n        return num ^ 2 ** int(log2(num)) - 1\n```\n```\nclass Solution:\n    def findComplement(self, num: int) -> int:\n        return ~num + (1 << num.bit_length())\n```\n```\nclass Solution:\n    def findComplement(self, num: int) -> int:\n        return next(n[0] for n in accumulate(count(0), lambda n,_:(n[0]^n[1], n[1]<<1), initial=(num, 1)) if n[0]<n[1])\n```\n```\nclass Solution:\n    def findComplement(self, num: int) -> int:\n        return int(\'\'.join(str(1^int(n)) for n in f\'{num:b}\'), 2)\n```
['Bit Manipulation', 'Bitmask', 'Python3']