← All problemsSign in

I - Prefix MEX Equation

Suppose you have two arrays $x$ and $y$, both of length $m$. You can perform the following operation however many times you like: - Choose an index $i$ ($1 \le i \le m$), and swap $x_i$ with $y_i$. The pair of arrays $(x, y)$ is said to be *good* if it's possible to make their prefix MEX arrays equal by performing several such swaps. Note that: - The MEX of a set of integers is the smallest non-

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.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start