Merge Sorted Lists
mediumDescription & examples
Combine two ascending singly linked lists into one ascending list. Return its head, or None/null when both inputs are empty. You may reuse the input nodes. Each ListNode has val and next fields. The examples show node values in traversal order.
Examples
first = [1, 4, 8], second = [2, 4, 9] → [1, 2, 4, 4, 8, 9]
first = [], second = [3] → [3]
Constraints
0 ≤ combined node count ≤ 10,000. Integer values range from -1,000,000 to 1,000,000. Inputs contain no cycles.
Guided help
Guided help is not available for this problem yet.
