Build an event streaming telemetry system that counts events.
Asked in the onsite coding 2 stage. Basic approach: use a hashmap of counts and clarify assumptions about event ordering. Follow-up: keep the last 60 seconds of counts, and return results every 30 seconds.
telemetry_counts(events, report_times)
events is a list of [timestamp, event_type] pairs sorted by timestamp. report_times is a sorted list of timestamps. Return a list of dictionaries, one per report time, where each dictionary maps event type to the number of events with timestamps in the inclusive window [report_time - 60, report_time].
def telemetry_counts(events, report_times):