FreeCareerPath
Build the PrimitiveEasy

Merge Two Sorted Lists

Write `merge_two_lists(a, b)` merging two ascending lists into one ascending list and returning its head. Splice the existing nodes rather than allocating new ones. [1,2,4] and [1,3,4] -> [1,1,2,3,4,4] A dummy head removes the "is this the first node" branch from the loop. When one list runs out, attach the other in one step — walking it node by node is wasted work.

What to expect: A timer starts when you begin. Edit the starter code, run it against the test suite as many times as you like, then finish when you're done. The reference solution and interviewer follow-up questions unlock only after you finish.

Log in to start this session

Timed sessions and your results for "Merge Two Sorted Lists" are saved to your account — logging in takes a few seconds.

Merge Two Sorted Lists — FreeCareerPath