36. Merge Two Sorted Lists

Merge two sorted linked lists into one sorted list by splicing the existing nodes together, and return its head.

Example 1

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

Example 2

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

A dummy head node removes the “is the result empty?” special case.

Linked List