Merge K Sorted Arrays
Medium
LC #23
min-heapk-way mergeNot attempted yet
You're given lists, a list of k lists, each sorted in
ascending order. Merge them into one sorted list and
return it.
(LeetCode 23 asks the same with linked lists; the heap idea is identical.)
Example 1
Input: lists = [[1,4,5],[1,3,4],[2,6]]
Output: [1,1,2,3,4,4,5,6]
Example 2
Input: lists = []
Output: []
Example 3
Input: lists = [[]]
Output: []
Constraints
0 <= k <= 10^40 <= len(lists[i]) <= 500- Total number of values
N <= 10^5 - Each
lists[i]is sorted ascending