Implement a Token Bucket Rate Limiter

Implement a rate limiter based on the Token Bucket algorithm.

You are given:

  • capacity: the maximum number of tokens the bucket can hold.
  • refill_rate: the number of tokens added per secon...

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: