MEX Variation
Suppose you have an array $B$ of size $M$. You may perform the following operation on it: - Choose an index $i$ such that $1 \le i \le M$ and subtract $1$ from $B_i$. This operation is allowed only if $B_i > 0$. Define $f(B)$ as the **minimum** number of operations needed to change the MEX$^\dagger$ of the array $B$. If it is impossible to change the MEX of $B$ using the given operations, w
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