← All problems

Merge Two Sorted Lists

Easy linked listsrecursion LeetCode ↗
Merge two sorted singly linked lists into a single sorted linked list, reusing the existing nodes (no new allocations except a dummy head). Return the head of the merged list.

Hints (0/3 revealed)

Log in to reveal hints progressively.

Complexity

Time O(n+m), Space O(1) iterative

Common pitfalls

  • Losing the head (no dummy)
  • Not handling exhausted lists

Your solution

Log in to save your code and track progress.