Problem
Two non-negative whole numbers are stored as linked lists, one digit per node, in **reverse order** (the ones digit comes first). Add the numbers and return the sum as a linked list in the same reverse format.
Example 1
- Input
- 2
- Output
- 4 -> 3 + 5 -> 6 -> 4 → 7 -> 0 -> 8
- Why
- 342 + 465 = 807
Example 2
- Input
- 0 + 0
- Output
- 0
Example 3
- Input
- 9
- Output
- 9 + 1 → 0 -> 0 -> 1
- Why
- 99 + 1 = 100
The numbers can be far too long to fit in a regular integer, so add digit by digit.
Constraints
1 <= number of nodes in each list <= 1000 <= Node.val <= 9Neither number has leading zeros, except the number 0 itself.