LeetCode 2 ·
Medium
Add Two Numbers
Two numbers are stored as reversed digit lists; return their sum as a list.
Try it
Step through the core mechanic. The simulator below runs the linked list shape this problem is built on.
Walk the pattern
No dedicated step-through for this one yet. The shape is Linked list — its pattern page has the interactive walkthrough, the reference implementation, and a five-problem progression that this problem sits inside.
The approach
Walk both lists together, summing digit + digit + carry, emit sum % 10, propagate sum / 10. Continue while either list remains or a carry survives.
| Aspect | Value |
|---|---|
| Pattern | Linked list |
| Recognise it by | Digit-by-digit addition with carry. |
| Time complexity | O(n) |
| Space complexity | O(n) |
| Difficulty | Medium |
Who asks it
Companies known to ask this problem, from public LeetCode company-tag aggregations. A signal of where to expect it, not a guarantee.