Given 2 Linked Lists containing single digit as data representing number with most significant digit at head and least significant at the tail return the addition of both.
The solution must not reverse the given linked lists and do it in O(n) time complexity and constant space complexity(Recursive solution will take O(n) space because of stack).
For example:
9 -> 3 -> 2 -> 2 ->
+
3 -> 4 -> 8 -> 3 ->
=
1 -> 2 -> 8 -> 0 -> 5 .
Can anyone help me out ?