Algo: the num^ans must equal to '1'*len(num)
def findComplement(self, num):
x = len(bin(num)[2:])
m = int('1'*x,2)
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.