← All problemsSign in

Counting MEX arrays

The $MEX$(minimum excluded) of an array is the smallest non-negative integer that doesn't belong to the array. For instance: - The MEX of [2, 2, 1] is 0 because 0 doesn't belong to the array. - The MEX of [3,1,0,1] is 2 because 0 and 1 both appear in the array but 2 doesn't. - The MEX of [0,3,1,2] is 4 because 0, 1, 2 and 3 all appear in the array but 4 doesn't. For some array $arr_1,arr_2...arr_

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