Back to exercises

Merge Two Sorted Linked Lists

Use a dummy head and repeatedly attach the smaller current node from either list. When one list runs out, append the remaining nodes from the other list.

Coding Exercises Easy O(n + m)

Merge Two Sorted Linked Lists

Use a dummy head and repeatedly attach the smaller current node from either list. When one list runs out, append the remaining nodes from the other list.

Merge two sorted linked lists and return the head of the merged list.