Write a rate limiter: given a time window and a limit, return how many of each event's operations are processed so that no consumer exceeds the limit within any window.
Unlock detailed company stats for this questionUpgrade
Rate Limit API: events arrive as (unix timestamp, number of operations, consumer). Write a class constructed with time_window (seconds, inclusive at both ends) and limit, with a method rate_limit(event) returning how many of the event's operations will be processed, such that no consumer is allowed more than limit operations within any time_window. Events arrive in non-decreasing timestamp order.
Community answers
No answers contributed by the community yet.
Related questions
Events are published to re-fire at a fixed interval between a start and an end time and can be unpublished. After each operation, return how many events have fired so far.Given a JSON file of records, write a program that consumes it and returns the filtered results based on the requirement.Related courses

Course
