Two test cases passed only, See my code

Let me know where is my error.

only 2 test cases are passed.

suppose
arr[1]=9;
arr[2]=9
then sum=18
means size of sum can be n(max of n1,n2) of greater than n so dont start with last index of sum
means don’t intialise k=n-1;
instead k=0 and find sum
and then at end print sum in reverse order

yeah for 9 9 mara bhi ans 18 aa rha he

and sum ka size mane n1 and n1 se max liya he ternary lga ke

your output is not according to sample output which is given in question
arr1=99
arr2=99
your ans is 19 8
but ans is 1, 9, 8, end

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.