Interview Query

Merge Sorted Lists

Start Timer

0:00:00

Upvote
41
Downvote
Save question
Mark as completed
View comments (59)
Next question

Given two sorted lists, write a function to merge them into one sorted list.

Bonus: What’s the time complexity?

Example:

Input:

list1 = [1,2,5]
list2 = [2,4,6]

Output:

def merge_list(list1,list2) -> [1,2,2,4,5,6]
.
.
.
.
.


Comments

Loading comments