0915. Partition Array into Disjoint Intervals
https://leetcode.com/problems/partition-array-into-disjoint-intervals
Description
Given an integer array nums
, partition it into two (contiguous) subarrays left
and right
so that:
Every element in
left
is less than or equal to every element inright
.left
andright
are non-empty.left
has the smallest possible size.
Return the length of left
after such a partitioning.
Test cases are generated such that partitioning exists.
Example 1:
Example 2:
Constraints:
2 <= nums.length <= 105
0 <= nums[i] <= 106
There is at least one valid answer for the given input.
ac
Last updated