Xor and Multiply
JJ has three integers $N$, $A$ and $B$ where $0 \le A, B \lt 2^N$. He wants to find a third integer $X$ such that: - $0 \le X \lt 2^N$ - the value of $(A \oplus X) \times (B \oplus X)$ is maximum. Here $\oplus$ represents the [Bitwise XOR](https://en.wikipedia.org/wiki/Bitwise_operation#XOR) operator. Can you help him find such an integer $X$? If there are multiple integers which satisfy the giv
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start