All Categories

Stack

LIFO for bracket matching, monotonic sequences.

Monotonic stack finds next greater/smaller in O(n).

Key Concepts

Monotonic Stack

Maintain sorted order in stack

Problems (18)