Merge sorted rosters

Write codeEasy12 min

Your task

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].

Examples

combined_worklist(rosters: list[list[int]]) -> list[int]
Example 1
Inputcombined_worklist([[1, 4, 9], [2, 3]])
Output[1, 2, 3, 4, 9]