The core insight

State diagram from Monotonic Stack / Deque. Shows violates invariant.

More from Monotonic Stack / Deque