Object-Oriented Programming · OpenAI · Medium
Design an aggregator that tracks message events in a long-running system. Each event is tied to a user, a chat, and a timestamp (a whole number of seconds). For any user and query timestamp, the aggregator must report how many events that user has recorded inside a trailing window of m seconds. The window is inclusive: [timestamp - m + 1, timestamp]. Events belonging to the same user arrive in strictly increasing timestamp order. To stay memory-efficient over an unbounded…
Checking your access…