Design Rate Limiter
Atlassian interview questions · Medium · Coding round · 6 tests
Implement an in-memory rate limiter. It is initialized with a TTL window in milliseconds and a maximum number of requests allowed inside that rolling window.
Interface
class RateLimiter {
constructor(ttlMs: number, maxRequests: number);
allow(nowMs: number): boolean;
}
Rules
Run your code with Ctrl+Enter to see results.