Welcome to the Python screen.
The question is on your right: Real-Time Telemetry Window Store. Read through the requirements first.
Run and submit your code as often as you need. You also have five interviewer messages this session - want to talk through your approach, or are you ready to start coding?
Design a data structure that stores a stream of vehicle sensor telemetry events and supports efficient real-time queries over a sliding time window. Each event is a pair (timestamp, value) for a single sensor, where timestamps are added in non-decreasing order. Implement a function that processes a list of operations and returns query results. Supported operations are: add(timestamp, value), avg(k) returning the average of values with timestamp >= current_timestamp - k + 1, and max(k) returning the maximum value in that same window. If the window is empty, return -1.
def process_telemetry(operations):