A monotonic stack maintains elements in sorted order. Either:
Monotonic decreasing: elements decrease from bottom to top
Monotonic increasing: elements increase from bottom to top When you push a new element, you first pop all elements that violate the monotonic property. This "cleanup" before pushing is what gives monotonic stacks their power.