Monotonic Stack
Increasing or decreasing?
Mono-decreasing Stack
Before: [5,4,2,1]
To push 3, we need to pop smaller (or equal) elements first
After: [5,4,3]Notes

Both nextSmaller and prevSmaller
Problems
Last updated