Problem
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 |
Solution1
Method: Recursive
Time Complexity:
Space Complexity:
1 | # Definition for singly-linked list. |
Solution2
Method: Iterative
Time Complexity:
Space Complexity:
1 | # Definition for singly-linked list. |
Solution3
Method: In-place Iterative
Time Complexity:
Space Complexity:
1 | # Definition for singly-linked list. |
or
1 | # Definition for singly-linked list. |