Mex Problem
CodeChefOpen on judge ↗
You are given array of $n$ element. In one move you can choose any non-negative number $k$ and replace any element of array with $k$. what is maximum possible MEX you can get if you can make any number of move of that type. MEX of array is minimum non-negative integer which is not present in array. MEX of array $[0,1,2,5]$ is $3$, $3$ is minimum non-negative integer not present in array
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