← All problemsSign in

Equal Mex Splitting

CodeChefRating 1428Open on judge ↗

Chef has an array $A$ of length $N$. Chef wants to select some **disjoint, non-empty** subarrays from $A$ such that: - The $mex$ of each of the selected subarray is the same. Note that the selected subarrays **need not cover** all the elements of the array. For e.g. if $A = [2, 0, 1, 6, 2, 1, 3, 0, 7]$, then one way in which Chef can select subarrays is as following: ${[0, 1], [1, 3, 0]}$ (Here

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