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.
Example:
1 | Input: 1->2->4, 1->3->4 |
递归解法
递归的方法每次确定一个元素的位置,将问题规模减小1。
1 | class Solution { |
非递归解法
1 | class Solution { |