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.
Input Format
Input is managed for you
Output Format
Output is managed for you
Constraints
Space complextiy = O(k) Time complexity = nlogk where k is the number of lists and n is number of elements across all lists.
Notice
Try First, Check Solution later
1. You should first read the question and watch the question video.2. Think of a solution approach, then try and submit the question on editor tab.3. We strongly advise you to watch the solution video for prescribed approach.Example
Input
4 5 10 20 30 40 50 7 5 7 9 11 19 55 57 3 1 2 3 2 32 39
Output
1 2 3 5 7 9 10 11 19 20 30 32 39 40 50 55 57