Problems > Sliding Window Minimum > Editorial

Sliding Window Minimum — Solution & Editorial

Back to the Problem

Monotonic deque of indices with increasing values: pop the back while ≥ the new element, drop the front when it leaves the window; the front is the minimum.

Complexity: O(N)