← All questions
MediumCoding

Maximum Xor Product

Asked atRippling
1Give yourself 5 minutes
2Answer out loud, not in your head
3Then compare with the answer below
0
Stuck? Show a way to structure it+
  1. 01Clarify the permitted bit range
  2. 02Separate fixed high bits from mutable low bits
  3. 03Process mutable bits from high to low
  4. 04Balance the two factors when a bit differs
  5. 05Apply modulus only after constructing values

Reference answer

Then expect these follow-ups

  • Why does balance maximize product for a fixed sum?

    Tests: correctness reasoning

  • How do you avoid overflow in the product?

    Tests: follow-up reasoning

Free to read · better with Enzo

Practice this out loud with Enzo

Enzo runs it as a mock interview, pushes back with follow-ups, and grades you on the rubric.

Next question