dsa · easy

Merge Two Sorted Lists

GreyOrangeLinked ListFoundation

You are given the heads of two sorted linked lists (represented as Python lists of integers). Merge the two lists into one sorted list and return it.

Arguments

**Example 1:** `` Input: list1 = [1,2,4], list2 = [1,3,4] Output: [1,1,2,3,4,4] ``

Constraints

0 <= lengths <= 50

Examples

Example 1

Input:
[1,2,4]
[1,3,4]

Expected:
[1,1,2,3,4,4]

Example 2

Input:
[]
[]

Expected:
[]

Open in the Dojo editor