Easy

Quiz

#21 Merge Two Sorted Lists

APPROACH

Merge sorted linked lists list1 and list2 by relinking their existing nodes into one ascending list. Return the new head.

Example 1:

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

Example 2:

Input: list1 = [], list2 = []
Output: []

Example 3:

Input: list1 = [], list2 = [0]
Output: [0]
1 of 4
1:00

What is the optimal approach for this problem?