All challenges
Multiple ChoiceHard 45s

Sliding window counter hybrid tradeoff

The sliding-window-counter algorithm approximates rate limiting by:
Options
  1. 1Storing the timestamp of every request in the interval, then counting how many fall inside the window on each incoming call
  2. 2Using a token bucket with no burst capacity, so tokens refill smoothly and the smoothed rate never exceeds the configured limit
  3. 3Weighting the previous fixed window's count by the overlap fraction and adding the current window's count
  4. 4Sampling one in ten requests and scaling the sampled count by ten to estimate the total rate across the whole interval

Think you can answer under pressure?

Get matched and answer live questions in 3-minute 1v1 battles. Elo ranking, badge tiers and bragging rights on the line.

Play this in a 3-minute battle