You are given an integer array nums.
You want to partition nums into contiguous subarrays by repeatedly selecting a non empty prefix from the remaining elements of nums, appending the MEX of the selected prefix to a result array, and removing that prefix from nums until nums becomes empty.
Return the lexicographically largest result array that can be formed.
Note: The MEX (minimum excluded value) of an array is the smallest non negative integer that does not appear in the array.
Constraints:
nums.length
nums[i]
You are given an integer array nums.
You want to partition nums into contiguous subarrays by repeatedly selecting a non empty prefix from the remaining elements of nums, appending the MEX of the selected prefix to a result array, and removing that prefix from nums until nums becomes empty.
Return the lexicographically largest result array that can be formed.
Note: The MEX (minimum excluded value) of an array is the smallest non negative integer that does not appear in the array.
Constraints:
nums.length
nums[i]