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
A public API throttles each client to at most `max_requests` calls within any `window_seconds`-long stretch, and a call is accepted only when fewer than `max_requests` already-accepted calls fall inside the window ending at its arrival; a throttled call is turned away and never counts against later ones. Given `calls`, the arrival timestamps in arrival order, return a parallel list of booleans that is True for each accepted call and False for each throttled 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.