Approach Summary
Use a monotonic deque storing indices. Maintain decreasing order of values; the front is always the maximum of the current window.
How to Recognize This Pattern
- Fixed window size
- Max in each window
Complexity Analysis
Time Complexity
O(n)
Space Complexity
O(k)
Tags
Array Deque Sliding Window