#445
Add Two Numbers II
specialist · 675 · lc medium +30 · verified · 62.4% accepted · 6,164 likes · top 64%
Description
Two non-empty singly linked lists represent non-negative integers with the most significant digit at the head, one digit per node, and no leading zeros (except for the number zero itself). Return a new linked list representing their sum in the same format.
Example 1:
Input: l1 = [7,2,4,3], l2 = [5,6,4]
Output: [7,8,0,7]
Example 2:
Input: l1 = [2,4,3], l2 = [5,6,4]
Output: [8,0,7]
Example 3:
Input: l1 = [0], l2 = [0]
Output: [0]
Code
1
2
3
4
5
6
7
8