Add Two Numbers Represented By Linked Lists
I found the problem at this link.
I have solved a similar problem from leetcode, but the digits in the linked lists were backwards, so it was easier since I can do regular addition starting at the beginning of the lists.
For this one, there are two approach:
Since method 1 is easy, we can have look at method 2
Accroding to geeksforgeeks, we need to watch out for the case that one link list is longer than the other. In that case, we will move the shorter list's last node to the position of the longer list's last node. Perform addition on two linked lists for the length of the shorter list. After that, we add the remaining digits in the longer lists to our result.