44. Merge k Sorted Lists

You are given k linked lists, each sorted ascending. Merge them into one sorted list and return its head.

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: []
Hint 1

At each step you need the smallest of k current heads.

Hint 2

A min-heap of size k gives it in O(log k).

HeapLinked ListDivide and Conquer