Go Back

Implement the SlidingWindowRateLimiter class

Xai
Backend Developer
Problem Description
Implement the SlidingWindowRateLimiter class so that it enforces a maximum number of requests within a rolling time window. The allow method is called before each request and should return whether the request is permitted, based on the number of requests made in the last window_seconds seconds. Example parameters (from comments): window_seconds = 5 max_requests = 2 Example timeline: T = 10 → window covers [5, 10].
Hints

No hints available for this question.