The Throttle Ceiling
A medium Python interview practice problem on DataDriven. Write and execute real python code with instant grading.
- Domain
- Python
- Difficulty
- medium
- Seniority
- L4
Problem
You are building the rate limiter that fronts a public API, where a client may make at most max_requests calls within any window_seconds-long stretch and a call that would push it past that cap is turned away without counting against later calls. Implement run_rate_limiter(calls, max_requests, window_seconds), where calls is the list of arrival timestamps in arrival order, and return a parallel list of booleans that is True for each accepted call and False for each rejected one.
Summary
Too many requests in too short a timeframe. Throttle it.
Practice This Problem
Solve this Python problem with real code execution. DataDriven runs your Python code in a real environment and grades it automatically.