Implement a Thread-Safe Token Bucket Rate Limiter

Implement a thread-safe Token Bucket rate limiter.

Background

Tokens are refilled into the bucket at a fixed rate up to a maximum capacity. A request must consume tokens to pass.

Require...

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: