Monotonic Stack · Compound Engineer

Monotonic Stack

A stack that keeps its values in order lets every element find its next smaller (or larger) neighbour in one pass. How it works, why it is O(n), and where it shows up.

DSAFreeIntermediateStep-through playerBy Aayush Ostwal
Spotted a mistake in this lesson?Report an issue →