Could some one explain what they want as output? By seeing the sample input and output, I can no way understand how does it correspond to the sum of two arrays?
Challenges: Sum of two arrays
Hi @Ishita28
Basically in this question you have to add both arrays from last index.
For example if
arr[4]={1,2,3,4}
brr[3]={5,6,2}
then you have to add
4 and 2
3 and 6
2 and 5
So resultant output will be 1 7 9 6
But according to the sample input and output, that is not the case.
Sample input given: 1,0,2,9 and 3,4,5,6,7
Sample output given: 3,5,5,9,6
yes it is because when you add 7 and 9 it results 16 so we place 6 at last index and pass 1 as carry and then we add 6+2 and add 1 which is carry and it results 9. This is how sum is computed.
carry - 0 0 0 1 0
arr - 3 4 5 6 7
brr - 1 0 2 9
+
sum - 3 5 5 9 6
Okay okay. Thank you so much.