Reported interview periodNot available
Fixed-Window Token Limiter
Implement a per-key limiter with one shared token limit and fixed window length. Commands are:
Practice focus- ("ALLOW", key, cost, timestamp) : accept if the key's usage plus cost does not exceed the limit; a rejected request consumes nothing. - ("RESET", key, timestamp) : clear that key's usage in the fixed window containing timestamp . The window containing time t starts at (t // window) window . Costs are non-negative integers; zero is allowed. Preserve input order. Return one result per command, using booleans for ALLOW and a consistent acknowledgment for RESET .…