A monotonic queue is a deque that keeps elements in decreasing (or increasing) order. For sliding window maximum, you pop smaller elements from the back when adding a new one, so the front is always the max. You also pop from the front when it leaves the window. Each element is added and removed at most once, so total time is O(n).