You are viewing a single comment's thread. Return to all comments →
Here is my Python solution!
def theGreatXor(x): amount = 0 greatest = int(math.log(x, 2)) for num in range(greatest): if (2 ** num) ^ x > x: amount += 2 ** num if (2 ** greatest) ^ x > x: amount += x - 2 ** greatest return amount
Seems like cookies are disabled on this browser, please enable them to open this website
The Great XOR
You are viewing a single comment's thread. Return to all comments →
Here is my Python solution!