Sum of two linked list

Please help me with the approach of this problem. How can we find the sum of two linked in this manner like traversing from right to left?

@mvermav19, refer here https://www.ideserve.co.in/learn/sum-of-two-linked-lists-using-recursion-set-2

can u please explain it either by some points or by code
Actually i’m not quite understanding this algorithm.

hi @mvermav19,
have you done this question or this type of question without recursion?
like calculating factorial of a large no, multiplication or addition only using loops?

yes,
i know how to solve these types of questions!

hi @mvermav19,
refer here (https://ide.codingblocks.com/s/660380) and there is a pic in the given link doing a dry run please keep them side by side and try to o a dry run on paper

hope this helps :slight_smile:


it’s still not giving the correct output.

hi @mvermav19,
input in this code should be addAtHead not tail look at the eg figure
and then finally reverse the ans you got

here’s the updated code https://ide.codingblocks.com/s/660404 (commented)
hope this should work

yeah
It’s working now!

@mvermav19 nice !!!

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.