Skip to content
intermediate

Monotonic Stacks & Queues

Maintain candidates in monotonic order so dominated values disappear permanently in boundary, histogram, and range-extrema problems.

Problems

Problems in Monotonic Stacks & Queues

Practice problems that share this primary solution pattern and compare the clues that reveal it.

Laptop displaying data analytics graph in a modern office setting, symbolizing growth and technology.
expert
12 min read

Maximal Rectangle

Turn each matrix row into a histogram, solve that histogram with a monotonic stack, and keep only the state that can still affect future rows.

View solution