Object-Oriented Programming · OpenAI · Medium
Problem: Build an in-memory rate limiter (token bucket or sliding window) Create a thread-safe, in-memory RateLimiter that determines whether an incoming request associated with a particular key may proceed. Required API allow(key: str, now_ms: int) -> bool Invoke this method once per request; it must report whether that request is permitted at now_ms. The interviewer may select either of these policies: Fixed/sliding window: permit no more than limit requests during each…
Checking your access…