ASAPUtils Logo ASAPUtils
Week 5

Add Two Numbers

Add Two Numbers as grade-school addition over reversed digit lists, with a dummy tail, carry invariant, C++ and JavaScript solutions, unequal-length handling, complexity, and an interactive digit-by-digit trace.

medium Linked Lists O(max(n,m)) time · O(max(n,m)) output space Open on LeetCode ↗

The problem

Two nonnegative integers are stored as reversed linked lists of decimal digits. Return their sum in the same least-significant-digit-first form.

2 -> 4 -> 3 plus 5 -> 6 -> 4 represents 342 + 465 and returns 7 -> 0 -> 8

Related Problems