← Back to companies
[ OK ] Loaded —
[ INFO ]
$ cd
$ ls -lt
01
02
03
04
05
$ ls -lt
01
02
03
04
05
user@intervues:~/$
You are given an array of k linked lists lists, where each list is sorted in ascending order. Return the sorted linked list that is the result of merging all of the individual linked lists.
Example 1:
Input: lists = [[1,4,5],[1,3,4],[2,6]] Output: [1,1,2,3,4,4,5,6] Explanation: The lists are: [ 1->4->5, 1->3->4, 2->6 ] merging them as [1->1->2->3->4->4->5->6]
Example 2:
Input: lists = [] Output: [] Explanation: The list is empty, return an empty list.
Example 3:
Input: lists = [[]] Output: [] Explanation: The list contains only one empty list, return an empty list.
0 <= k <= 1040 <= n <= 105-104 <= Node.val <= 104lists.length == k0 <= lists[i].length <= 5 * 104lists[i] is sorted in ascending order.