Merge k sorted lists
You are given k sorted lists of integers (each list ascending). Merge them into one ascending list and return it. Lists are encoded as plain Python lists; some may be empty and the outer list may be empty. Aim for O(N log k) where N is the total number of elements.
Implement
merge_k_sorted(lists: list[list[int]]) → list[int]Examples
in
[[[1,4,5],[1,3,4],[2,6]]]out[1,1,2,3,4,4,5,6]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 25 min
solution.py
InputExpectedGot
[[[1,4,5],[1,3,4],[2,6]]][1,1,2,3,4,4,5,6]not run yetsample