Back to problems

Time Range Event Counter

Algorithm · Snowflake · Medium

Event Counts Within a Time Window A system receives a stream containing multiple kinds of events. Create a counter that can store each event and report how many events of a requested type happened during a specified inclusive timestamp interval. Implement the EventCounter class: EventCounter() Creates a new counter instance. void receive(string eventType, int timestamp) Adds an occurrence of eventType at the given timestamp. int count(string eventType, int startTime, int…

Checking your access…