Queue / Deque (Monotonic Queue)
Use for sliding window max/min in O(n), BFS level order.
What this pattern is
Maintain a deque of candidate indices in decreasing order to get sliding window max/min in O(n). Also useful for BFS queues.
Exercise: maxSlidingWindow
Task: Given nums and window size k, return an array of the maximum in each sliding window.
Example: nums=[1,3,-1,-3,5,3,6,7], k=3 → [3,3,5,5,6,7]
Edge cases: k=1, k=nums.length, negatives, duplicates.