1
class Solution {
2
public int partitionDisjoint(int[] nums) {
3
int mts = nums[0]; // max till scan
4
int mtp = nums[0]; // max till partition
5
int idx = 0;
6

7
for (int i = 1; i < nums.length; i++) {
8
int val = nums[i];
9
if (val < mtp) {
10
idx = i;
11
mtp = mts;
12
}
13

14
mts = Math.max(mts, val);
15
}
16

17
return idx + 1;
18
}
19
}

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0