Optimal Algorithmic Approach
Monotonic Deque: the front always holds the index of the current window's max.
Core Invariants & Edge Cases
- Use a monotonic decreasing deque of indices
- Remove indices outside the window from the front
- Remove smaller elements from the back before adding new element