Two Digit Streams
The upper chain represents l1 and l2 as alternating digit nodes for a compact simulation.
Loading...
Loading Curriculum...
Loading Subject...
Loading Topic...
Loading Lesson...
Loading Lab...
Add Two Numbers walks two reverse-order digit lists together, creates one output digit per step, and carries overflow into the next node.
The upper chain represents l1 and l2 as alternating digit nodes for a compact simulation.
Carry survives between nodes, so each step depends on the previous sum.
A new result node is appended for each computed digit.
When one list ends, the other list and carry still continue.