Monotonic Stack Concept & Pattern
Original12/22/25Less than 1 minute
🧠 Concept
Next greater/smaller value or Last greater/smaller value problem
Leverage stack to maintain a monotonically increasing or decreasing list
Pop smaller values, then push new big value
Pop biggers values, then push new small value
🛠️ Pattern
- Store indices in stack for convenience
