What is the approach for this problem?

Any refernce or hint on how to solve this problem. Can I reverse the array add the elements and again display by reversing the array

hello @gvspraveen113

yeah u can try this approach, it will work.

another way->
we use two pointers one pointer will point to ending of first array(say i) and second pointer point to ending of second array (say j) and use one carry variable that will store last generated carray (initially it will be 0).

final value= (arr1[i]+arr2[j] + carry)%10 //extracting digit
carry = (arr1[i]+arr2[j]+carry)/10 // extracting carray
iā€“; //move pointer to left by one position
jā€“;.//same here
same thing u have to repeat on remaining digits to get the final array

check this code for better clarity-

https://ide.codingblocks.com/s/480811 can you check this once. Its passing for 2 testcases and failing for 2

@gvspraveen113

try this case
3
9 9 9
3
9 9 9