You are given an array of k linked-lists, each sorted in ascending order. Merge all lists into one sorted list. Lists are given as arrays.
Example 1
Input: lists = [[1,4,5],[1,3,4],[2,6]]
Output: [1,1,2,3,4,4,5,6]
Explanation: Taking the smallest front element each time from [1,4,5], [1,3,4] and [2,6] produces 1, 1, 2, 3, 4, 4, 5, 6.
Example 2
Input: lists = [[]]
Output: []
Explanation: The only list is empty, so the merged list is empty.
Example 3
Input: lists = []
Output: []
Explanation: There are no lists to merge, so the result is empty.
Pair up the `k` lists and merge each pair using the two-list merge from the previous problem. After one round you have `k/2` lists; after another, `k/4`; and so on. After `log k` rounds, only one list remains.
Run checks all cases above. Submit evaluates all test cases.