HTMLify
LeetCode - Number Complement - Python
Views: 318 | Author: abh
1 2 3 4 5 6 7 | class Solution: def findComplement(self, num: int) -> int: b = bin(num)[2:] b = b.replace("0", "2") b = b.replace("1", "0") b = b.replace("2", "1") return int(b, 2) |