Problems > Bounded XOR Count > Editorial

Bounded XOR Count — Solution & Editorial

Back to the Problem

Binary digit DP over ~40 bits carrying two tight flags: one for the upper bound N on i, one for the constraint (i XOR X) ≤ Y compared bit by bit from the top.

Complexity: O(bits)