Problem
You get l1 and l2, the heads of two non-empty linked lists. A linked list is a chain of nodes, and each node links to the next node.
Each list shows a non-negative integer. Each node holds one digit, and the digits are in reverse order. Thus, the first node holds the ones digit.
Add the two integers, and return the sum as a linked list in the same form. A number does not start with the digit 0, except the number 0 itself.
Example 1
- Input:
- l1 = [4,6,1], l2 = [8,2]
- Output:
- [2,9,1]
- Explanation:
- The lists show the numbers 164 and 28. The sum is 192.
Example 2
- Input:
- l1 = [9,9], l2 = [1]
- Output:
- [0,0,1]
- Explanation:
- The sum of 99 and 1 is 100.
Example 3
- Input:
- l1 = [5], l2 = [5]
- Output:
- [0,1]
Constraints
- The number of nodes in each list is in the range [1, 100].
- 0 <= Node.val <= 9
- The lists show numbers without leading zeros, except the number 0.
SysRound wrote this statement. A reference solution checks every example.
Related questions
Continue with questions that share topics or the same question type.
- Add Two Numbers II
Coding · Linked List · Math · Stack
- Merge Two Sorted Lists
Coding · Linked List · Recursion
- Basic Calculator III
Coding · Math · Recursion · Stack
- Find the Winner of the Circular Game
Coding · Array · Math · Queue
Sources · 2 references
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 3 records
Amazon
Leetcode 2. Add Two Numbers
Reported Mar 13, 2025 · 1 source report
MID_LEVEL
Source snapshot: Nov 12, 2026
View sourceMeta
Leetcode 2. Add Two Numbers
Reported Oct 13, 2025 · 3 source reports
SENIOR, STAFF
Source snapshot: Nov 12, 2026
View sourceOracle
Leetcode 2. Add Two Numbers
Reported Oct 28, 2025 · 3 source reports
SENIOR
Source snapshot: Nov 12, 2026
View source
LeetCode company tags · 13 records
Amazon
Add Two Numbers
Reported date not specified · Source window: 30d