Merge Two Sorted Lists
Easy
LC #21
mergedummy headNot attempted yet
You're given the heads of two linked lists, list1 and
list2, each sorted in non-decreasing order. Splice
their nodes together into one sorted list and return its
head.
Example 1
Input: list1 = [1,4,9], list2 = [2,3,10]
Output: [1,2,3,4,9,10]
Example 2
Input: list1 = [], list2 = [0,5]
Output: [0,5]
Example 3
Input: list1 = [], list2 = []
Output: []
Constraints
- 0 ≤ nodes in each list ≤ 2 · 10⁴
- -100 ≤ Node.val ≤ 10⁵
- Both lists are sorted in non-decreasing order