Split a permutation of 0 to n-1 into as many contiguous chunks as possible so that sorting each chunk separately gives the sorted array. Return the number of chunks.
Unlock detailed company stats for this questionUpgrade
Given an array that is a permutation of 0 to n-1, split it into as many contiguous chunks as possible so that sorting each chunk on its own and joining the chunks gives the fully sorted array. Return the largest number of chunks.
Community answers
No answers contributed by the community yet.
Related questions
Cut an array into contiguous subarrays using the minimum number of cuts such that every resulting subarray has a GCD greater than 1.Related courses

Course

