Code Room
CodingHardcod-g443
Subject Stream processingLevel Senior–Staff~35 minCommon in Distributed systems · Algorithms & data structures interviewsIndustries Software development, Technology

Question

You are given `streams`, a list of already-ascending lists of integer timestamps (each individual stream is sorted, but the streams are independent). Merge them into a single ascending list of timestamps. Duplicate timestamps across or within streams are all kept. Implement an efficient k-way merge rather than concatenating and sorting. Some streams may be empty; `streams` itself may be empty.

Implement
merge_streams(streams: list[list[int]]) → list[int]
Examples
in[[[1,4,7],[2,3],[5]]]out[1,2,3,4,5,7]
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.

Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.

Run or narrate your approach, then ask the coach.