Protect Gatekeep's customers from traffic floods with token buckets: exact integer refills, a testable clock, per-client limits and bounded memory.
Token bucket
A bucket that refills at a fixed rate, in exact integer arithmetic, driven by a clock you pass in.
Per-client limits
A bucket per client, overrides for paying clients, Retry-After values and pruning of idle buckets.
Expensive requests
Some endpoints cost more than one token. Support weighted requests without starving them.
Coding puzzles train one skill. Here's what else the job needs, how to practise it, and how to balance interview prep with real project work.
What a design document is for, a half-page template (components, data structures, trade-offs, open questions) and a worked example, before you write any code.
What Big-O tells you on the job: the costs of common operations, amortised O(1), inputs that trigger the worst case, memory as a cost, and when to measure instead of guessing.