All base and perf test failing

Tried and handled various cases but I don’t understand the issue. I’m getting write answers for various cases like:
5
9 9 9 9 9
1
1
my ans = 1 0 0 0 0 0

and for
3
9 9 9
3
9 9 9
my ans = 1 9 9 8

same thing was happening for the palindrome module

I took a look at your code, and one hint I can give you is to simplify the code. The two inner while loops are not necessary. You were on the right track towards the top when you got the sum, then modulo 10, then idea of creating a new node. But just there itself it started going off track. The first suggestion I would give is to write the code for the case where you don’t have a carry. Then incrementally make it complex: try making small tweaks to that incrementally to add number that gives a carry that transfers for only 1 digit. Then next try this for a bigger input. Then try for an input that has a carry that itself causes next digit to have another carry.

To help you our further, I have a test case for you with a bigger input number (this one has a carry however).

Input:
14
2 6 4 0 0 5 0 6 2 2 2 7 9 5
16
8 0 8 1 8 5 9 9 1 4 6 7 2 4 4 8

Expected output should be:
8 1 0 8 2 6 0 4 2 0 8 9 5 2 4 3

Closing this topic as your issue is resolved by the mentor. If it is still not resolved, Kindly un-mark the accepted solution or create a new topic and post this question as a reference link in the description of the new topic.