Example 1
- Input
- list1 = [1,2,4], list2 = [1,3,4]
- Output
- [1,1,2,3,4,4]
Take 1 from list1, 1 from list2, 2 from list1, 3 from list2, and the two 4s. All six original nodes remain, including both occurrences of each repeated value, in non-decreasing order.