Partition Array into Disjoint Intervals
Problem statement
Split nums into a nonempty left prefix and a nonempty right suffix so every value in the left part is less than or equal to every value in the right part.
Return the smallest possible length of the left part. A valid split is guaranteed.
Function
partitionDisjoint(nums: int[]) → intExamples
Example 1
nums = [5,0,3,8,6]return = 3The prefix [5,0,3] has maximum 5 and the suffix [8,6] has minimum 6.
Constraints
2 <= nums.length <= 10^5.- Values fit in signed 32-bit integers.