can you please on which basis we have find the sum of 2 arrays(Whether index wise or to take maximum sum)
And also Explain the test case given in the problem,
Doubt in Problem Sum of Two Arrays
The sample test case for sum of 2 array is :
4
1 0 2 9
5
3 4 5 6 7
Here, you have to take sum and carry for every index while traversing array from right to left,
thus u have :
9+7=16, sum=16, carry=1
2+6+1=9, sum=9, carry=0
0+5=5, sum=5, carry=0
1+4=5, sum=5, carry=0
3, sum=3, carry=0
thus u have : 3, 5, 5, 9, 6 as the overall output
I hope you understood this
giving run time error in some of the test cases
Your code is not giving correct output in the following sample test case :
4
1 0 2 9
4
9 0 2 9
the answer should be : 1, 0, 0, 5, 8, END
but your code is giving as : 0, 0, 5, 8, END;
try to work more on this type of input
there was a slight mistake in your code, due to which it was showing runtime error as u have decremented the value of i twice, I have corrected tht, but implement the above stated type of condition and then try to submit.
Thank you soo much I have changed the Code for the condition of n=m and it worked…tysm
i am also facing the same problrm.Can you pl send your code
Here