Given are two linked lists with number contained as their node values. Entire linked list nodes put together to form a number. Add both the numbers and return the sum as another linked list.
Sample Input:
List 1:
9->9->9->9->8->8
List 2:
1->2
Sample Output:
1->0->0->0->0->0->0
- Reverse both the linked lists.
- Sum up each node value along with a carry(maintain a carry variable) and store the result to a new node.
- Repeat the loop until both the linked lists encounter null.