Add Two Numbers
Medium
Topics
You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order, one digit per node. Add the two numbers and return the sum as a linked list, also in reverse order.
Example 1
Input: l1 = [2,4,3], l2 = [5,6,4] Output: [7,0,8] Explanation: 342 + 465 = 807.
Example 2
Input: l1 = [9,9,9], l2 = [1] Output: [0,0,0,1]
Constraints
- 1 <= list length <= 100
- 0 <= Node.val <= 9
- No leading zeros except the number 0 itself.
Run ⌘' · Submit ⌘⏎