DSA Advanced Problems

Max Chunks to Make Sorted II

Split an array, which may contain duplicates, into the maximum number of contiguous chunks such that sorting every chunk independently and concatenating them produces the fully sorted array.