You are given two non-empty linked lists representing two non-negative integers.
The digits are stored in reverse order, and each node contains a single digit. Return the sum as a linked list.
For the Cheetcode runner, linked lists are represented as plain arrays in node order.
Work with node references instead of array indexes. Make sure you preserve the next pointers you still need before changing links.
Examples
Input: l1 = [2,4,3], l2 = [5,6,4] Output: [7,0,8]
Input: l1 = [0], l2 = [0] Output: [0]
Constraints
- The number of nodes in each linked list is in the range [1, 100].
- 0 <= Node.val <= 9
- The list represents a number that does not have leading zeros, except the number 0 itself.