Build a Sliding-Window Metrics Toolkit

variable windows and monotonic deques

Challenge 4 of Arrays & StringsIntermediate~55 minFree

Learn the sliding-window technique by building the tools behind streaming metrics, log analysis, and substring problems. You will implement fixed windows, variable windows with hash maps, a monotonic-deque maximum, and a streaming moving average class. Each step adds one function toward a small toolkit you could drop into a real metrics pipeline.

5 steps

  1. 1Fixed-size window: max sum
  2. 2Variable window: longest unique substring
  3. 3Variable window: at most k distinct
  4. 4Monotonic deque: window maxima
  5. 5Streaming moving average
Start step 1