← Back
00:00

Event Rate Limiter

Netflix interview questions · Medium · Coding round · 5 tests

You are building a small logger for a streaming platform. Incoming events carry timestamps that never decrease from one call to the next. Print an event only when no event with the same name has been printed during the preceding windowSeconds seconds.

Interface

class EventLogger {
  constructor(windowSeconds: number);
  shouldPrint(timestamp: number, eventName: string): boolean;
}
Idle