less than 1 minute read

Given a list of sorted lists of integers, merge them into one large sorted list.

Constraints

  • 0 ≤ n * m ≤ 100,000 where n is number of rows and m is the longest column in lists

https://binarysearch.com/problems/Merging-K-Sorted-Lists

Examples

Example 1

Input

  • lists = [[], [], [10, 12], [], [3, 3, 13], [3], [10], [0, 7]]

Output

  • answer = [0, 3, 3, 3, 7, 10, 10, 12, 13]

Solution

Leave a comment