Sliding Window Maximum — interactive algorithm visualization
Hard · Monotonic Deque · time O(n) · space O(k)
A deque of indices kept decreasing; the front is always the window max. The definitive monotonic-deque problem.
Example input: nums = [1,3,-1,-3,5,3,6,7], k = 3
Step through a verified execution trace - every step shows the real state, the invariant that keeps the algorithm correct, and asks you to predict what happens next.
Solve Sliding Window Maximum in the editor · All 16 visualizations
Previous: Number of Recent Calls · Next: Design Circular Queue