Add Two Numbers
mediumAdd two numbers represented as linked lists with digits in reverse order
Add Two Numbers
Key Insight
Process digit by digit with carry, like grade-school addition on linked lists
Step 1Setup
342 + 465 = ?carry = 0
p1
2
4
3
null
List 2
p2
5
6
4
null
Two numbers in reverse digit order: 342 as [2,4,3] and 465 as [5,6,4].
1 / 6