Write a program to merge
k
sorted singly linked lists and return it as one sorted list.
Example 1
Input:
[
1->7->9,
1->3->4,
4->6
]
Output: 1->1->3->4->4->6->7->9
Explanation: Here k = 3. when we merge the above lists, we get:
1->7->9->1->3->4->4->6
When we sort this unified list, we get the following output:
1->1->3->4->4->6->7->9
Example 2
Input:
[
1,
1->2,
1->2->3
]
Output: 1->1->1->2->2->3
Explanation: Here k = 3. when we merge the above lists, we get:
1->1->2->1->2->3
When we sort this unified list, we get the following output:
1->1->1->2->2->3