Monotonic Structures Checkpoint

Stacks and deques that stay sorted.


1. For next greater element, the stack should be:
2. When popping a bar at index i in the histogram algorithm, width is:
3. Each index is pushed/popped at most once, so total time is:
4. For sliding window maximum, the deque stores values in: