Adding 2 arrays and printing sums

i unlocked the solution. why is the java code provided there? I’m doing a c++ course.

also, I don’t understand why you guys have to ask questions which use concepts which you haven’t even bothered to teach in this useless course. do you expect us to learn only the basics and do the advanced questions on our own? is that how you prepare students to be “job-ready”?

I don’t even care if I’m sounding rude right now. I’ve wasted the past 2 hours trying to solve just this one question, the answer to which is not available anywhere.

i kept getting segmentation errors. then i got compilation errors, which the compiler didn’t even explain so I couldn’t do anything to correct them. then I tried using sstream to convert the string into numbers and add them normally, but even that isn’t working.

pathetic course, I’m extremely disappointed, and this isn’t the first time I’ve faced this issue. I’ve had to skip many questions before because there was no solution available.

HOW DO I ADD 2 ARRAYS FROM THE END!!! HOW DO I TAKE A CARRY-OVER NUMBER?!

hello @yamika

for any course content related issue/feedback pls write an email to support team.
email id -> [email protected]

if u get any doubt related to ds-algo then u can always ask using ask doubt feature online TA’s will help u.

for this problem .

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-

also pls drop ur email id in the chat box, team will contact u …

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.