Glossary: Coding Interviews in C++
Monotonic stack
A stack kept in increasing (or decreasing) order by removing items that break the order as new ones arrive. It is used to answer "next bigger value" questions in O(n).
Glossary: Coding Interviews in C++
A stack kept in increasing (or decreasing) order by removing items that break the order as new ones arrive. It is used to answer "next bigger value" questions in O(n).