Ezvor

3094. Guess the Number Using Bitwise Questions II

MediumBit Manipulation Preparing judge… LeetCode
Bit ManipulationInteractive

Hints

Hint 1
Ask the number 0 and save the result in base.
Hint 2
Ask 2i for 0 <= i < 30.
Hint 3
If the result is greater than base for some i, then this bit is a set bit in n.
Hint 4
What can be done to revert the effect of the XOR.
Hint 5
Doing XOR again with the same number reverts the effect.