21. Merge Two Sorted Lists
Practice Merge Two Sorted Lists for free on NudgeCode: Easy, Linked List pattern. Write it in Python or JavaScript, run the tests in your browser, and ask for a hint when you are stuck.
You are given the heads of two linked lists, each sorted in non-decreasing order. Splice their nodes together into one sorted list and return its head.
Example
list1 = [1,2,4], list2 = [1,3,4] -> [1,1,2,3,4,4]
Constraints
- 0 <= length of each list <= 50
- -100 <= Node.val <= 100