Grokking 75: Top Coding Interview Questions
Ask Author
Back to course home

0% completed

Vote For New Content
Add Two Numbers (medium)
On this page

Problem Statement

You are given two non-empty linked lists that represent two non-negative integers, where each node contains the single digit. The digits are stored in reverse order. Add these two numbers and return the sum as a linked list.

You can assume the numbers do not have leading zeros, except for the number 0 itself.

Examples

Example 1:

  • Input: l1: [1, 2, 3], l2: [4, 5, 6]
  • Expected Output: [5, 7, 9]
  • Justification: 321 + 654 = 975, which in reverse order is [5, 7, 9].

Example 2:

  • Input: l1: [7, 8], l2: [6, 7, 8, 9]

.....

.....

.....

Like the course? Get enrolled and start learning!

On this page