November challenge leetcode

Question:- https://leetcode.com/explore/challenge/card/november-leetcoding-challenge/564/week-1-november-1st-november-7th/3522/

Code link:-

I think my logic is correct but still getting wrong answer.

Hey @div_yanshu07
You are thinking in the right approach
But your implementation is not correct
In some cases you are not adding carry and there is no need to take special case of both having length 1

Just make LL until one of stack is empty and also
Make LL by ( a+b+carry) %10 for next iteration
And carry=(a+b+carry)/10

Then finally if some stack still have elements
Then keep making LL by( a+carry)%10
And carry=(a+caary) /10

And at last if there is still carry left then add carry to LL