A queue delivered events out of order and with duplicates. Each event is {"id": str, "ts": int, ...}.
Keep only the event with the highest ts for each id; if two events for an id have the same ts, keep
the one that appears later in the input. Return the kept events sorted by id.
Implement latest_events. Input: events: list[dict]. Returns: list[dict].
def latest_events(events: list[dict]) -> list[dict]:
return events
Run executes the public tests. Submit grades against public and hidden tests.
A queue delivered events out of order and with duplicates. Each event is {"id": str, "ts": int, ...}.
Keep only the event with the highest ts for each id; if two events for an id have the same ts, keep
the one that appears later in the input. Return the kept events sorted by id.
Implement latest_events. Input: events: list[dict]. Returns: list[dict].
def latest_events(events: list[dict]) -> list[dict]:
return events
Run executes the public tests. Submit grades against public and hidden tests.