The Throttle Wall
A hard Python mock interview question on DataDriven. Practice with AI-powered feedback, real code execution, and a hire/no-hire decision.
- Domain
- Python
- Difficulty
- hard
- Seniority
- L4
Interview Prompt
An API gateway throttles each client independently: within any `window_ms` window a client may keep at most `max_requests` accepted calls. The `operations` list opens with `['init', max_requests, window_ms]` to configure the limiter and is followed by `['is_allowed', client_id, timestamp]` decisions; return one result per entry, `None` for the configure step and then `True` or `False` for each decision. A call is allowed only when the client has fewer than `max_requests` accepted calls still inside the half-open window `(timestamp - window_ms, timestamp]`, and a denied call is never recorded, so a throttled client becomes eligible again as soon as its earlier accepted calls age out.
Summary
Stop the abusers. Let the rest through.
How This Interview Works
- Read the vague prompt (just like a real interview)
- Ask clarifying questions to the AI interviewer
- Write your python solution with real code execution
- Get instant feedback and a hire/no-hire decision