LeetCode 2: Add Two Numbers from Naive to Optimal Carry Simulation

Subtitle / Summary This problem is just grade-school addition on a linked list: add one digit at a time, propagate carry, and append one final node if carry remains after both lists end. We move from naive ideas to the optimal one-pass solution, then map it to real engineering scenarios. Reading time: 12-15 min Tags: linked list, carry, simulation, LeetCode 2 SEO keywords: Add Two Numbers, LeetCode 2, reverse-order list, carry, dummy node Meta description: Use dummy + tail + carry to sum two reverse-order linked lists in O(max(m,n)) time, with common pitfalls, engineering analogies, and six-language runnable implementations. A — Algorithm (Problem & Algorithm) Problem Restatement You are given two non-empty linked lists representing two non-negative integers. Digits are stored in reverse order, and each node stores one digit. Return their sum as a linked list in the same reverse order. Except for number 0, the input numbers do not have leading zeros. ...

February 11, 2026 · 14 min · map[name:Jeanphilo]