题目:
题解:
func mergeTwoLists(list1, list2 *ListNode) *ListNode {if list1 == nil {return list2 // 注:如果都为空则返回空}if list2 == nil {return list1}if list1.Val < list2.Val {list1.Next = mergeTwoLists(list1.Next, list2)return list1}list2.Next = mergeTwoLists(list1, list2.Next)return list2
}