← Questions

Per-key fixed-window cost limiter

0
xAICodingLast asked Sep 2026

Build a rate limiter that meters cost rather than request count. Each key may spend at most limit units in each fixed window of window seconds, with windows aligned to multiples of window. Process commands: ALLOW key cost t answers whether the request fits (and records it if so), and RESET key clears that key's usage.

Write and test your solution herePython in your browser, the question's tests level by level, saved for you.Sign in to start coding