📚 PracticeEasyAlgorithm ProblemCoding Ready
Merge Two Sorted Lists
linked-listrecursion
LeetCode #21
Updated Dec 20, 2025
Question
Merge two sorted linked lists and return it as a sorted list.
LeetCode: Merge Two Sorted Lists
Example:
Input: list1 = [1,2,4], list2 = [1,3,4]
Output: [1,1,2,3,4,4]
Hints
Hint 1
Use a dummy node to simplify the logic. This avoids having to handle the head separately.
Hint 2
Compare the values at the current positions of both lists. Attach the smaller node to your result list.
Hint 3
Don't forget to attach any remaining nodes from either list after one list is exhausted.
Your Solution
python
Auto-saves every 30s
Try solving the problem first before viewing the solution
Learning Resources
Related Problems
0:00time spent