Tap here to switch tabs
Problem
Submissions

Problem: Partition Array into Disjoint Intervals

med
30 min
Try to solve the Partition Array into Disjoint Intervals problem.

Statement

Given an integer array nums, partition it into two contiguous subarrays, left and right, such that:

  • Every element in left is less than or equal to every element in right.

  • left and right are non empty.

  • left has the smallest possible length.

Return the length of left after performing such a partition.

Constraints:

  • 2≤2 \leq nums.length ≤105\leq 10^5

  • 0≤0 \leq nums[i] ≤106\leq 10^6

  • There is at least one valid answer for the given input.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Partition Array into Disjoint Intervals

med
30 min
Try to solve the Partition Array into Disjoint Intervals problem.

Statement

Given an integer array nums, partition it into two contiguous subarrays, left and right, such that:

  • Every element in left is less than or equal to every element in right.

  • left and right are non empty.

  • left has the smallest possible length.

Return the length of left after performing such a partition.

Constraints:

  • 2≤2 \leq nums.length ≤105\leq 10^5

  • 0≤0 \leq nums[i] ≤106\leq 10^6

  • There is at least one valid answer for the given input.