Tap here to switch tabs
Problem
Submissions

Problem: Max Chunks To Make Sorted

med
30 min
Try to solve the Max Chunks To Make Sorted problem.

Statement

Given an integer array arr of length n that contains a permutation of the values from 00 to n−1n - 1, split arr into the maximum number of contiguous chunks.

After splitting, sort each chunk individually and then concatenate the sorted chunks in their original order. Return the largest possible number of chunks such that the final concatenated array is fully sorted in nondecreasing order.

Constraints:

  • n == arr.length

  • 1≤1 \leq n ≤10\leq 10

  • 0≤0 \leq arr[i] << n

  • All elements of arr are unique.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Max Chunks To Make Sorted

med
30 min
Try to solve the Max Chunks To Make Sorted problem.

Statement

Given an integer array arr of length n that contains a permutation of the values from 00 to n−1n - 1, split arr into the maximum number of contiguous chunks.

After splitting, sort each chunk individually and then concatenate the sorted chunks in their original order. Return the largest possible number of chunks such that the final concatenated array is fully sorted in nondecreasing order.

Constraints:

  • n == arr.length

  • 1≤1 \leq n ≤10\leq 10

  • 0≤0 \leq arr[i] << n

  • All elements of arr are unique.