Simple merge
Input
[1, 3, 5], [2, 4, 6]
Output
[1, 2, 3, 4, 5, 6]
Merging two sorted lists interleaves their elements in ascending order.
Full lesson preview
Merge two sorted singly linked lists into a single sorted list and return it as a Python list.
Problem statement
Task
Examples
Input
[1, 3, 5], [2, 4, 6]
Output
[1, 2, 3, 4, 5, 6]
Merging two sorted lists interleaves their elements in ascending order.
Input format
Output format
Constraints
Samples
Input
[1, 2, 3], []
Output
[1, 2, 3]
Second list is empty, so the merged result is the first list.