Interview Query

Merge N Sorted Lists

Start Timer

0:00:00

Upvote
7
Downvote
Save question
Mark as completed
View comments (15)
Next question

Given a list of sorted integer lists, write a function sort_lists to create a combined list while maintaining sorted order without importing any libraries or using the 'sort' or 'sorted' functions in Python.

Example:

Input:

lists = [
[1,2,3,4,5,6],
[2,5,7,8],
[3,9,10,12],
[0,1,2,8]
]

Output:

def sort_lists(lists) -> [0,1,1,2,2,3,3,4,5,5,6,7,8,8,9,10,12]
.
.
.
.
.


Comments

Loading comments