← Back to Games

Window Extreme Finder

Find max/min in sliding windows using a deque!

Window Max
-
Window Min
-

🗃️ 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:

  1. Maintain a decreasing deque (front has largest)
  2. Remove indices outside window from front
  3. Remove smaller elements from back before adding new
  4. Front of deque = current window maximum

Time: O(n), Space: O(k)