In a Meta-style ranking pipeline, multiple already-sorted candidate lists may need to be combined into one globally sorted stream. Given k sorted integer lists, merge them into a single sorted list.
Implement a function that takes a list of sorted lists and returns one sorted list containing all values from the input lists.
lists, where lists[i] is a sorted list of integers in non-decreasing orderExample 1
lists = [[1,4,5],[1,3,4],[2,6]][1,1,2,3,4,4,5,6]Example 2
lists = [[], [0], [2,2,2]][0,2,2,2]0 <= k <= 10^40 <= total number of elements across all lists <= 10^5-10^9 <= lists[i][j] <= 10^9Aim for a solution better than flattening everything and sorting again when k is large.