Max Chunks To Make Sorted LeetCode solution in JavaScript

1
var maxChunksToSorted = function (arr) {
2
let count = 0,
3
cumSum = 0;
4
arr.forEach((el, index) => {
5
cumSum += el - index;
6
if (cumSum === 0) count++;
7
});
8
return count;
9
};

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0