Back to DSA
Add Two Numbers
mediumTwo non-empty linked lists represent two non-negative integers with their digits stored in reverse order (least significant digit first). Each node holds a single digit. Add the two numbers and return the result as a new linked list, also in reverse digit order.
Examples
Example 1:
Input:
l1 = [3,5,2], l2 = [4,7,1]Output:
[7,2,4] Example 2:
Input:
l1 = [8,9], l2 = [5]Output:
[3,0,1]Hints
1234567