Skip to main content
All Questions

Design a sliding window rate limiter.

Unlock detailed company stats for this questionUpgrade

Design a rate limiter for an API service. Implement a class that allows a client (identified by a unique clientId) to make at most N requests within a rolling time window of T seconds. Implement allowRequest(clientId, timestamp), which returns true if the request is allowed and false otherwise.

Requirements: support multiple clients independently; process a large number of requests efficiently; optimize time complexity per request; consider how inactive clients can be removed from memory over time.

Format · Technical interview.

Community answers

No answers contributed by the community yet.

Related courses

Course

Software Engineering Interview Prep

Land your dream software engineering role at Google, Amazon, Microsoft, Meta, Apple, and other top companies. Learn from mock interviews, frameworks, and advice from senior candidates—practice data structures, algorithms, system design, people management, behavioral interviews, and more.

Course

System Design Interviews

Learn how to answer the latest system design questions across product, infrastructure, and AI domains. Features in-depth video examples, written breakdowns, and helpful reference patterns. Watch senior engineers and managers answer these questions in mock interview videos.