PracHub
QuestionsCoachesLearningGuidesInterview Prep
|Home/Software Engineering Fundamentals/Roblox

Implement a Rolling-Window Rate Limiter

Last updated: Jul 15, 2026

Quick Overview

Implement a single-process rolling-window rate limiter where only accepted requests consume capacity. Define exact boundary behavior, expire old timestamps efficiently, and extend the design to independent per-IP limits with safe cleanup of inactive state.

  • medium
  • Roblox
  • Software Engineering Fundamentals
  • Software Engineer

Implement a Rolling-Window Rate Limiter

Company: Roblox

Role: Software Engineer

Category: Software Engineering Fundamentals

Difficulty: medium

Interview Round: Technical Screen

## Implement a Rolling-Window Rate Limiter Implement an in-memory rate limiter that accepts at most `limit` requests in any rolling interval of `window_seconds`. The method should return `True` when the current request is accepted and `False` when it is rejected. After explaining the single-stream version, extend the design so each client IP has its own independent rolling-window limit. ### Constraints & Assumptions - For this practice version, request timestamps are supplied as integer seconds in nondecreasing order. - Only accepted requests count toward the limit. - A timestamp exactly `window_seconds` older than the current request is outside the active window. - `1 <= limit`; `1 <= window_seconds`. - The implementation is in-memory and single-process; distributed coordination is out of scope. ### Clarifying Questions to Ask - Do rejected requests count toward future decisions? - Is the interval left-open or left-closed at the oldest boundary? - Are timestamps guaranteed to arrive in order? - For the follow-up, should inactive IP state be removable? ### Hints - Identify which past accepted requests can still affect the current decision. - Avoid rescanning requests that have already fallen outside the active window. - In the per-IP extension, consider how and when an inactive key can be discarded. ### What a Strong Answer Covers - Exact rolling-window and boundary semantics. - A data structure that expires old accepted timestamps efficiently. - Correct handling of rejection without consuming capacity. - Time and space complexity for one stream and for many IPs. - Per-IP state isolation plus a safe cleanup policy for inactive keys. ### Follow-up Questions - How would the algorithm change if timestamps could arrive out of order? - Can you reduce memory if a very large limit is configured? - How would you test requests that land exactly on the window boundary? - What information is needed to delete an inactive IP without changing future decisions?

Quick Answer: Implement a single-process rolling-window rate limiter where only accepted requests consume capacity. Define exact boundary behavior, expire old timestamps efficiently, and extend the design to independent per-IP limits with safe cleanup of inactive state.

|Home/Software Engineering Fundamentals/Roblox

Implement a Rolling-Window Rate Limiter

Roblox logo
Roblox
Jul 13, 2026, 12:00 AM
mediumSoftware EngineerTechnical ScreenSoftware Engineering Fundamentals
1
0

Implement a Rolling-Window Rate Limiter

Implement an in-memory rate limiter that accepts at most limit requests in any rolling interval of window_seconds. The method should return True when the current request is accepted and False when it is rejected.

After explaining the single-stream version, extend the design so each client IP has its own independent rolling-window limit.

Constraints & Assumptions

  • For this practice version, request timestamps are supplied as integer seconds in nondecreasing order.
  • Only accepted requests count toward the limit.
  • A timestamp exactly window_seconds older than the current request is outside the active window.
  • 1 <= limit ; 1 <= window_seconds .
  • The implementation is in-memory and single-process; distributed coordination is out of scope.

Clarifying Questions to Ask

  • Do rejected requests count toward future decisions?
  • Is the interval left-open or left-closed at the oldest boundary?
  • Are timestamps guaranteed to arrive in order?
  • For the follow-up, should inactive IP state be removable?

Hints

  • Identify which past accepted requests can still affect the current decision.
  • Avoid rescanning requests that have already fallen outside the active window.
  • In the per-IP extension, consider how and when an inactive key can be discarded.

What a Strong Answer Covers

  • Exact rolling-window and boundary semantics.
  • A data structure that expires old accepted timestamps efficiently.
  • Correct handling of rejection without consuming capacity.
  • Time and space complexity for one stream and for many IPs.
  • Per-IP state isolation plus a safe cleanup policy for inactive keys.

Follow-up Questions

  • How would the algorithm change if timestamps could arrive out of order?
  • Can you reduce memory if a very large limit is configured?
  • How would you test requests that land exactly on the window boundary?
  • What information is needed to delete an inactive IP without changing future decisions?
Loading comments...

Browse More Questions

More Software Engineering Fundamentals•More Roblox•More Software Engineer•Roblox Software Engineer•Roblox Software Engineering Fundamentals•Software Engineer Software Engineering Fundamentals

Write your answer

Your first approved answer each day earns 20 XP.

Sign in to write your answer.
PracHub

Master your tech interviews with 8,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • AI Coding Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.