Merge many sorted lists
You get lists, a list of k lists of integers, each sorted in non-decreasing order (some may be empty). Return one sorted list with every value from all of them, duplicates included.
Aim for O(N log k) for N values in total, instead of concatenating and sorting.
Besides the tests, one large input (1,800 lists, 5,400 values) with a ~250 ms limit (scaled to your device's speed): brute force won't pass.
Examples
merge_sorted([[1,4,5],[1,3,4],[2,6]])→[1,1,2,3,4,4,5,6]merge_sorted([])→[]merge_sorted([[],[1]])→[1]