Given an array of
kTime Complexity: The time complexity of your solution should be O(N log k), where N is the total number of nodes across all input linked lists and k is the number of input linked lists. This is because each node is visited at most once for sorting, and the merge operation takes O(k) time for each node.
Space Complexity: The space complexity of your solution should be O(N), where N is the total number of nodes across all input linked lists. This is because all nodes from the input linked lists need to be stored in the merged linked list.
Note: This problem requires you to develop an efficient algorithm to merge the input linked lists while maintaining their sorted order. The algorithm should be able to handle a large number of input linked lists and nodes efficiently.
Input: {"lists":[[1,4,5],[1,3,4],[2,6]]} Output: [1,1,2,3,4,4,5,6]
Solve problems, verify your skills, and earn XP.