Limit of MEX
For an array $B$ consisting of non-negative integers, let $g(B, x)$ denote the maximum possible ${MEX}^\dag$ of the array $B$ we can obtain, by appending $x$ integers to $B$. For example, $g([1, 2, 4], 1) = 3$ as we can obtain the array $[1, 2, 4, 0]$ by appending $0$ which results in $MEX = 3$. It can be shown that there exists a non-negative integer $C$ such that $g(B, x + 1) - g(B, x) = 1$ f
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