Merge three lists
Input
merge_k_sorted([[1,4,7],[2,5,8],[3,6,9]])
Output
[1, 2, 3, 4, 5, 6, 7, 8, 9]
All three sorted lists are merged into a single sorted list.
Full lesson preview
Merge k sorted lists of integers into one sorted list efficiently.
Problem statement
Task
Examples
Input
merge_k_sorted([[1,4,7],[2,5,8],[3,6,9]])
Output
[1, 2, 3, 4, 5, 6, 7, 8, 9]
All three sorted lists are merged into a single sorted list.
Input format
Output format
Constraints
Samples
Input
[[1, 4], [2, 3]]
Output
[1, 2, 3, 4]
Two sorted lists are merged into one sorted list.