Per-User Sliding Window Rate Limiter

Implement a per-user sliding window rate limiter: each user may be allowed at most k requests within the last t seconds.

Conventions

  • The window is (now - t, now]: a request exactly at the lef...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: