Add Two Numbers LeetCode (LinkedList)

If you see the problem, it is normal with two arrays then we will go with the actual problem.

here I iterate any of the arrays from 0 to n, sum the elements of two arrays with the carry, then I save the face value to the carry (sum/10) and place the value to the result array(result[i]=sum%10) and print the array after the iteration.

Now come back to the linked list, here we have to keep the same logic but here we have to iterate the linked list.

I think you understand the logic, now lets try it with the recurssive approach, I will update it with the recurrsive approach soon.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Rajendra Rajaram

Rajendra Rajaram

Simple but impactful | coder| blogger| dreamer | version 1.0.2–14–09–1986 telegram @rajendra_mcdix