3948. Lexicographically Maximum MEX Array
You are given an integer array nums. You want to construct an array result by repeatedly performing the following operation until nums becomes empty: - Choose an integer k such that 1 <= k <= len(nums). - Compute the MEX of the first k elements of nums. - Append this MEX to result. - Remove the first k elements from nums. Return the lexicographically maximum array result that can be obtained
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