← Questions

Maximum XOR product

0
MicrosoftCodingLast asked May 2026

Given a, b and n, choose x with 0 <= x < 2^n to maximize (a XOR x) * (b XOR x), returned modulo a large prime. Explain the bit-by-bit greedy that keeps the two factors as close as possible. Only the title of this report was public; the details follow the common version.

Write and test your solution herePython in your browser, the question's tests level by level, saved for you.Sign in to start coding