Hardware interview practice
Merge two sorted linked lists
Merge two linked lists sorted by node value and return one sorted list.
Reviewed example
Work through one case
Input
a = 1 -> 3 -> 5, b = 1 -> 2 -> 6Expected output
1 -> 1 -> 2 -> 3 -> 5 -> 6Taking from a when equal preserves stable ordering while reusing every input node.
What to cover
Requirements
- Reuse the existing nodes.
- Keep the merge stable when values are equal.
- Append the remaining tail after one input is exhausted.
