问题https://leetcode.com/problems/merge-two-sorted-lists/description/Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.思路方法一:在两条有序链表的前提下,逐个比较小的放在前面,大的放在后面,最后还有剩下的某条直接放在最后面即可;方法二:使用递归的思路解决,小的放在前面,剩下的和另一条做比较,直到递归结束,值得注意的是输入数据很长时可能会StackOverFlow;代码
01-14 20:06