Two of my testcases are not passing. Please help me out.
Here is my code.
Array- Sum of Two Arraays
Hi @akankshaanand99
Your code is failing test cases like
5
5 4 3 2 1
5
9 8 7 6 5
Here your code is giving output as 15, 3, 0, 8, 6, END but the correct output is 1, 5, 3, 0, 8, 6, END
Rectify your code for this type of input then all test case will pass.
The output of your example should be- 15, 3, 0, 8, 6, END which is what I’m getting.
The question does not specify what to do when the 0th index has a carry.
Yes you are right it is not mentioned in the question statement but have a look at sample case explanation. It is written there that first digit represents carry over , if any (0 here ). And in the case i have mentioned the carry is 1 so you have to represent the first digit as 1 and second digit as 5.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.