Max Chunks To Make Sorted LeetCode solution in Java

1
class Solution {
2
public int maxChunksToSorted(int[] arr) {
3

4
int max = 0, count = 0;
5
for (int i = 0; i < arr.length; i++) {
6
max = Math.max(arr[i], max);
7
if (i == max) count++;
8
}
9
return count;
10
}
11
}

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0