Skip to content
intermediate

Monotonic Stacks & Queues

Maintain monotonic candidates for next-greater, histogram, and sliding-window 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