Problem 768 · Hard

Max Chunks To Make Sorted II

A monotonic stack of chunk maxima merges whenever a smaller value arrives.

Open the interactive visualisation