Your question is Parse and Order Event Streams. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Hudl receives sports telemetry events from recording and analysis surfaces. Events can arrive out of order, and some events may omit their timestamp attribute. Implement a function that returns the events in playback order.
An event is represented as a dictionary. A timestamp, when present, is a non-negative integer measured in milliseconds. Apply these ordering rules:
timestamp key come after all timestamped events.Implement order_telemetry(events), where events is a list of dictionaries and each dictionary contains an event key and may contain a timestamp key. Return a new list containing the same dictionaries in the required order.
def order_telemetry(events):