Skip to content
advanced

Challenge: a sliding window rate limiter

Implement this from the stub. Hidden tests grade the behaviour you write, not the comments you leave.

Challenge: A Sliding Window Rate Limiter

export interface SlidingWindowOptions {
  limit: number
  windowMs: number
  now: () => number
}

export class SlidingWindowLog {
  constructor(options: SlidingWindowOptions) {
    // Your implementation here
  }

  tryAcquire(): boolean {
    // Your implementation here
  }
}
challenge — implement from scratchCtrl+↵ submits · Ctrl+Shift+↵ runsstarter code