🗃️ Monotonic Deque (indices)
Deque is empty
← Front (answer)
Back (insert) →
📊 Window Results
Results will appear here...
💡 Monotonic Deque Algorithm
For finding maximum in each window of size K:
- Maintain a decreasing deque (front has largest)
- Remove indices outside window from front
- Remove smaller elements from back before adding new
- Front of deque = current window maximum
Time: O(n), Space: O(k)