Add Two Numbers (Linked List)
Problem Two non-negative numbers are given as linked lists of digits in reverse order (least-significant digit first). Add them and return the sum as a linked list in the same format.
Input / Output
- Input: heads of two linked lists, each a number stored least-significant-digit first.
- Output: the head of a linked list representing the sum.
Constraints
- Lists may differ in length; a final carry may add one extra digit.
- Each node holds a single digit 0–9.
Example
- [2,4,3] + [5,6,4] → [7,0,8] (342 + 465 = 807).
added …