0021. Merge Two Sorted Lists
Easy | Linked List + Recursion | 16ms (98.84%), 13.4 MB (87.61%)
Last updated
Was this helpful?
Easy | Linked List + Recursion | 16ms (98.84%), 13.4 MB (87.61%)
Last updated
Was this helpful?
Source: GitHub:
Merge two sorted linked lists and return them as a sorted list. The list should be made by "splicing" together (with) the nodes of the first two lists.
Therefore, top-down recursion could help us sort by in-place modification on either l1 or l2 as a starting node.