You are given an array of k linked-lists, each linked-list is sorted in ascending order.
Merge all the linked-lists into one sorted linked-list and return it.
To simplify input for the web runner, the linked lists are provided as a single JSON array of arrays, where each inner array represents one sorted linked list.
Input:
[[1,4,5],[1,3,4],[2,6]]
Output:
[1,1,2,3,4,4,5,6]
Input:
[]
Output:
[]
Input:
[[]]
Output:
[]
Your program must print a single JSON array representing the merged sorted list so it can be compared with the expected output.
No submissions yet.
Discuss brute-force merging, divide-and-conquer, and min-heap based approaches along with time complexity.