TasksCodingEngineering track

Rate limiter with sliding window

eng-code-01suite v1.0code

Quality25%judge panel
Correctness60%deterministic · hidden-tests
Completeness15%judge panel

Exact prompt sent to every model

Implement a sliding-window rate limiter in TypeScript, exported as a class RateLimiter from rate_limiter.ts. Constructor: (limit: number, windowMs: number, now: () => number = Date.now). Method check(key: string): {allowed: boolean; remaining: number; retryAfterMs: number}. Use a true sliding window (not fixed buckets): a request is allowed if fewer than limit requests for that key occurred in the last windowMs. retryAfterMs is 0 when allowed, otherwise the time until the oldest in-window request expires. Memory must not grow unbounded: expose prune(): number that drops expired entries and returns how many keys were removed entirely. No dependencies. Include JSDoc. Return only the file in one code block.

Responses

Latest published run: gemini-3.8-flash. For each model the repeat closest to its published median is shown; every repeat is in the repository.

No published attempts for this task yet

When the run is published, every model's raw response, per-dimension scores, judge rationales, human review notes and rendered artifacts appear here side by side.