Alice and Mex
CodeChefOpen on judge ↗
Alice has known the concept of MEX (Maximum excluded), which represents the minimum non-negative integer that does not belong to the array. For instance: - The MEX of [2,3,1,4] is 0 because 0 does not belong to the array. - The MEX of [1,1,0,2,2] is 3 because 3 does not belong to the array. Bob challenges Alice and gives him an array $A$ of length N and the task is to count the number of subarra
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