This question evaluates understanding of algorithmic and system-level design for per-key rate limiting, including data structures, time/space complexity, concurrency, hot-key mitigation, and distributed deployment in the Coding & Algorithms domain.
Design and implement a rate limiter that enforces request limits per key (e.g., per user ID or API key).
allow(key, timestamp)
→ returns
true
if the request is allowed, else
false
.
How would you adapt the design/implementation if the service must handle 100K QPS? Discuss: