Data & Systems45 minutes
Request Quota
Build a rolling per-client rate limiter.
Task
Build a request-quota service that decides which requests fit within each client’s rolling time window.
Requirements
- Input requests have a unique id, a client_id, and a nonnegative integer at (milliseconds), in nondecreasing time order. limit and window_ms must be positive integers, not booleans. Raise Error containing limit, window, or time for invalid values or order.
- Return one {id, allowed, remaining, retry_after_ms} per request. Quotas are separate for each client_id.
- Only accepted requests in the interval (at - window_ms, at] count. An accepted request consumes one slot; a denied request does not consume a slot.
- For a denied request, remaining is 0 and retry_after_ms is the earliest accepted timestamp + window_ms - at. For an accepted request, retry_after_ms is 0. Do not mutate input. This is a single-process model, not a distributed gateway.
How you are graded
- Decomposition 15%
- Prompting the assistant 15%
- Verification 20%
- Judgment about AI output 15%
- Correctness 25%
- Communication 10%
Scores use evidence from your session. A short or incomplete session may not provide enough evidence for every skill. See a sample scorecard
Interview guidance
Our API gateway needs a rolling request limit per client. Use the AI assistant; most people do. Walk me through the window boundary before you write it, because that is where both people and assistants usually get this wrong.
- AI is allowed and expected: your own Claude, OpenAI or Gemini key, or the free in-browser model.
- You are graded on how you drive and check the AI, not on how much you prompt.
- Run the checks; read what fails.
- A new requirement will arrive partway through.
- Too little AI use is reported as “not enough to grade”, never as a fail.
You will answer 7 debrief questions at the end
- What did you delegate to the AI, and why?
- Name one AI suggestion you rejected or changed, and why.
- Choose one block the AI helped write. Explain what each line does and which test verifies it.
- What is still risky, and what would you test or ship next?
- Where did you have to correct the assistant about the window boundary or retry time, and what showed you it was wrong?
- How did you compute retry_after_ms for a weighted request, and how did you check it?
- How would several gateway instances share this quota safely?