Chapter 2 Solution 5 is incorrect
muddi900 opened this issue · 3 comments
muddi900 commented
The output liked list is in reverse order. It is the solution to the follow-up.
brycedrennan commented
Are you sure? The followup input and answer are in forward order. The existing solution appears correct in that it's inputs and outputs are in reverse order.
muddi900 commented
The stack based solution would result in last in first out. Last in is the hundreds digit. It also worked the same when I tested it.
brycedrennan commented
The question is about a linked list, not a stack.
The question explicitly states that the output should be a reverse linked list in the example it provides.
EXAMPLE
Input:(7-> 1 -> 6) + (5 -> 9 -> 2).That is,617 + 295.
Output: 2 -> 1 -> 9. That is, 912.