Maximise XOR of a given integer with a number from the given range
Given q queries each of specifies three integers x, l, r. We have to find an integer from given range [l, r] inclusive, such that it gives maximum XOR with x. All values are assumed to be positive. We will show two ways to solve this interesting problem.
Exploring The Game of Nim
Nim is a mathematical game of strategy in which two players take turns removing objects from distinct heaps. The key to the theory of the game is the binary digital sum of the heap sizes "exclusive or" (xor). It is called the nim-sum. Find implementations of winning strategy and applications