Actually, I’m not able to figure out the output form in the given sample output which is :-
Sample Input
4
1 0 2 9
5
3 4 5 6 7
Sample Output
3, 5, 5, 9, 6, END
how the sum is calculated?
Problem in sum of two array
Hey, this is simple to understand the calculation consider an array as a number
1029 + 34567 = 35596
Here in this problem you just have to perform this simple addition with 2 arrays instead of 2 numbers.
still can’t understand ?
Hey Prabhjot,
this problem is pretty simple, you will be given input in this format
- N, size of first array
- N more input numbers, elements of first array
- M, size of second array
- M more input numbers, elements of second array
Output
elements of resultant array which will be the sum of arrays.
for eg.
input:
4
1 0 2 9
5
3 4 5 6 7
output:
3, 5, 5, 9, 6, END
How this output comes?
it is pretty simple, treat the two arrays as two numbers and add them like we add two numbers i.e. add the elements from last one by one.
1 0 2 9
+ 3 4 5 6 7
= 3 5 5 9 6