Merge event streams
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]]) → listExamples
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
solution.py
InputExpectedGot
[[[[1,"a"],[4,"d"]],[[1,"b"],[3,"c"]]]]["a","b","c","d"]not run yetsample