I tried the above approach and the answer is coming out to be correct. But I think that it is not the best approach and the code is somewhat cumbersome. Please tell a optimised way to approach this problem.
Arrays-Sum Of Two Arrays Problem doubt
1st thing that u can optimize is reduce space there is no need for ra2 u can do it with one single array
2nd is that u r making to many cases for n and m
just make u can add the number from 2 array if both contain the number
that is
while(n>=0 && m>=0)
after this u can check which array is left
if(n>=0)
if(m>=0)
only one of the two if condition is executed