Merge sorted rosters
Each ward in a hospital keeps its own roster of outstanding lab requests, already ordered from most urgent to least urgent by a numeric priority score (smaller = more urgent, each roster ascending). The lab wants one combined worklist. Given the rosters as a list of ascending integer lists, produce a single ascending list containing every score. Rosters may be empty, and the same score can appear in several rosters. Example: rosters = [[1, 4, 9], [2, 3]] gives [1, 2, 3, 4, 9].
Implement
combined_worklist(rosters: list[list[int]]) → list[int]Examples
in
[[[1,4,9],[2,3]]]out[1,2,3,4,9]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 12 min
solution.py
InputExpectedGot
[[[1,4,9],[2,3]]][1,2,3,4,9]not run yetsample