Linked List addition with reversal, Google Interview
0 Answers
Linked List addition with reversal, Google Interview
| Flag | PURGE
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
Email me when people comment.
Email me when people comment.
Loading...
An error occurred in subscribing you.
Email me when people comment.
Email me when people comment.
Loading...
An error occurred in subscribing you.
CareerCup is the world's biggest and best source for software engineering interview preparation. See all our resources.