Code RoomMerge event streams
MediumPrep Room Coding #1241

Merge event streams

CodingDistributed systemsAlgorithms & data structuresMid–Senior~30 min

You are given several event streams, each a list of [timestamp, payload] pairs already sorted by ascending timestamp. Merge them into a single chronologically ordered list of payloads. When multiple events share the same timestamp, order them by the index of the stream they came from (lower stream index first). Return the list of payloads in merged order.

Implement
merge_event_streams(streams: list[list[list]]) → list
Examples
in[[[[1,"a"],[4,"d"]],[[1,"b"],[3,"c"]]]]out["a","b","c","d"]
What a strong answer looks like

State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.

0:00 of about 30 min
InputExpectedGot
[[[[1,"a"],[4,"d"]],[[1,"b"],[3,"c"]]]]["a","b","c","d"]not run yetsample