Merge Two Sorted Lists

Easy · Linked Lists · about 10 minutes

Asked at Amazon, Microsoft, Apple, LinkedIn, Confluent, Arm.

list1 and list2 are each sorted ascending. Combine them into a single ascending list by relinking their existing nodes, and return the combined list's head.

Related guides