23. Merge k Sorted Lists 🔥
Hard
Problem:
Input: lists = [[1,4,5],[1,3,4],[2,6]]
Output: [1,1,2,3,4,4,5,6]
Explanation: The linked-lists are:
[
1->4->5,
1->3->4,
2->6
]
merging them into one sorted list:
1->1->2->3->4->4->5->6What to learn:
Heap queue (or heapq) in Python
Solution:
Time Limit Exceeded
Last updated