Glossary: Coding Interviews in Go
Monotonic stack
A stack kept in strictly 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) time.
Glossary: Coding Interviews in Go
A stack kept in strictly 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) time.