Merge K Sorted Lists
hard
1. You are given a list of lists, where each list is sorted. 2. You are required to complete the body of mergeKSortedLists function. The function is expected to merge k sorted lists to create one sorted list.
Constraints
Space complextiy = O(k) Time complexity = nlogk where k is the number of lists and n is number of elements across all lists.
Format
Input
Input is managed for you
Output
Output is managed for you
Example
Sample Input
4
5
10 20 30 40 50
7
5 7 9 11 19 55 57
3
1 2 3
2
32 39
Sample Output
1 2 3 5 7 9 10 11 19 20 30 32 39 40 50 55 57
Question Video