Keep a tail on the result. Always attach the smaller of the two current heads, then advance that list.
In easy words
Like merging two sorted queues into one line: whoever has the smaller ticket goes next.
Where this shows up
Merge step of merge-sort, combining calendars, and k-list merge (with a heap).
Key facts
Dummy node - avoids a special case for the first real node.
Compare heads - attach the smaller one.
Advance - only that list moves.
Remainder - splice the leftover list at the end.
What to remember
Time - O(n + m).
Space - O(1) extra if you reuse nodes.
Stable - take from l1 when values are equal.
Empty list - result is the other list.
Theory
Because both lists are already sorted, the next global minimum is always one of the two heads. Reusing existing nodes means you only retarget pointers.
Problem Statement
Merge two sorted linked lists and return the head of the merged list.