Merge two sorted linked lists and return it as a new sorted list. The new list should be made by splicing together the nodes of the given lists. Example: Input: list1 = [1,2,4], list2 = [1,3,4] Output: [1,1,2,3,4,4] Explanation: Merge the nodes while maintaining sorted order. Pattern focus: Merge Two Sorted Lists (simple pointer merge).
list1 = ListNode, list2 = ListNode
return ListNode
Example 1:
Input:
list1 = [1,2,4] list2 = [1,3,4]
Output:
[1,1,2,3,4,4]
Explanation:
Merged sorted order from both lists.