Redirecting to
NADOS

Merge K Sorted Linkedlist

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.

You are given an array of k linked-lists, each linked-list is sorted in increasing order.
Merge all the linkedlists into one sorted linkedlist and return it.
Input Format
3 sorted linkedlist :
{
0->0->0->null,
0->0->1->1->1->2->2->4->null,
0->0->0->0->5->5->6->null
}
Output Format
after merging them : 
0->0->0->0->0->0->0->0->0->1->1->1->2->2->4->5->5->6->null
Question Video
Constraints
0 <= k <= 10^5
0 <= size of linkedlist <= 1000
Sample Input
3
3
0 0 0
8
0 0 1 1 1 2 2 4
7
0 0 0 0 5 5 6
Sample Output
0 0 0 0 0 0 0 0 0 1 1 1 2 2 4 5 5 6 


  • Asked in Companies
  • Related Topics






Video Solution

Code Solution

Run
 
Run
Id Name