Monotonic Deque and Sliding Window Maximum
Track the maximum of a moving window in O(1) per step, using a deque that only ever shrinks in one direction.
8 min readUpdated 2026-09-03stackqueuedequesliding-window
Track the maximum of a moving window in O(1) per step, using a deque that only ever shrinks in one direction.