FastPrepAdd Two Numbers Stored in Reversed Lists
Problems/Add Two Numbers Stored in Reversed Lists

Add Two Numbers Stored in Reversed Lists

Expedia logoExpedia● MediumINTERNONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Two Expedia intern write-ups name this task. A post from 2023 links the well-known Add Two Numbers problem as a question in the second of two interviews held on one day, and says the interviewer gave a hint about cases the first attempt missed. An entry from a campus process, with a September 2022 interview date, names an add-two-numbers linked-list problem for its third video round.

Neither write-up states the rules itself. Here, digits run from the ones place upward, the order on the problem page each one points to. Each list has 1 to 100 digits. The last node is never 0 unless the number is 0 itself. The sum comes back in that same form. The second candidate calls both numbers positive, but this version also allows 0.

Our version is about 90% the same as the reported questions.

The linked lists first and second each hold a whole number that is 0 or larger. Each node holds one digit, and the digits go from the ones place upward. For example, the list [3,4,2] stores the number 243.

Build and return a linked list for their total, written the same way: one digit per node, ones digit first.

Neither number has leading zeros, so the last node of a list is never 0 unless the whole list is the single node 0. Your answer must follow the same rule. For example, a sum of zero is returned as [0].

Function

addTwoNumbers(first: ListNode, second: ListNode) → ListNode

Examples

Example 1

first = [3,4,2]second = [8,6]return = [1,1,3]
first
342
second
86
return
113

first stores 243 and second stores 68. Their sum is 243 + 68 = 311, which is stored as [1,1,3].

Digit by digit: 3 + 8 = 11, so write 1 and carry 1. Then 4 + 6 + 1 = 11, so write 1 and carry 1. Then 2 + 1 = 3, so write 3.

Example 2

first = [9,9,9]second = [1]return = [0,0,0,1]
first
999
second
1
return
0001

999 + 1 = 1000. The carry moves through every digit of first and is still 1 at the end, so the answer gets one more node: [0,0,0,1].

Example 3

first = [0]second = [0]return = [0]
first
0
second
0
return
0

0 + 0 = 0, which is the single node [0].

Constraints

  • Each list has between 1 and 100 nodes.
  • Every node value is a digit from 0 to 9.
  • The last node of each list is not 0, unless the list is the single node 0.

More Expedia Onsite Interview questions

  • Scramble StringONSITE INTERVIEW · Seen Sep 2026
  • Smallest Sufficient TeamONSITE INTERVIEW · Seen Sep 2026
  • Check Anagram Pairs Index by IndexONSITE INTERVIEW · Seen Oct 2025
  • Fresh Oranges Left After Rotting StopsONSITE INTERVIEW · Seen Oct 2025
  • Longest Increasing SubsequenceONSITE INTERVIEW · Seen Oct 2025
  • Lowest Common Ancestor with Repeated and Missing ValuesONSITE INTERVIEW · Seen Oct 2025
  • Shortest Substring with Exactly K OnesONSITE INTERVIEW · Seen Oct 2025
  • Middle Element of a Linked ListONSITE INTERVIEW · Seen Nov 2024
  • Minimum in a Rotated Sorted ArrayONSITE INTERVIEW · Seen Sep 2024
  • Mirror Image Binary TreesONSITE INTERVIEW · Seen Sep 2024

Similar questions at other companies

  • Add Two Numbers IIBloomberg LP · PHONE SCREEN · ONSITE INTERVIEWBloomberg LP interview questions
  • Subtract Forward-Order Linked-List NumbersMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
  • Add Numbers Stored in Four-Digit ChunksZipRecruiter · ONSITE INTERVIEWZipRecruiter interview questions
  • Add Two Numbers Stored as Linked ListsCapital One · ONSITE INTERVIEWCapital One interview questions
  • Add Forward Linked-List Numbers Using RecursionPeopleStrong · PHONE SCREENPeopleStrong interview questions
  • Add NumbersCisco · OACisco interview questions
  • Binary Linked List to DecimalJP Morgan Chase · OAJP Morgan Chase interview questions
  • Integers With Multiple Sum of Two CubesCharta Health · PHONE SCREEN · ONSITE INTERVIEWCharta Health interview questions
  • Reverse a Sublist of a Linked ListSalesforce · ONSITE INTERVIEWSalesforce interview questions
  • Dice-Walk Winning ProbabilityGoogle · PHONE SCREEN · ONSITE INTERVIEWGoogle interview questions

Interview reports that mention this question

  • Expedia Intern Final Round in 2022: 15 Experiences (Part 3 of 6)
  • Expedia Intern Final Round in 2023: 17 Experiences (Part 2 of 6)

Expedia interview experiences

  • Expedia Intern Final Round in 2021: 28 Experiences (Part 4 of 6)
  • Expedia Intern Finals Before 2020: 14 Experiences (Part 6 of 6)
  • Expedia Intern Final Round in 2020: 24 Experiences (Part 5 of 6)
  • Expedia SWE Intern Final Round: 126 Experiences (Part 1 of 6)
All Expedia interview questionsSee Expedia hiring insights
Saved
/**
 * Definition for singly-linked list.
 * public class ListNode {
 *     int val;
 *     ListNode next;
 *     ListNode() {}
 *     ListNode(int val) { this.val = val; }
 *     ListNode(int val, ListNode next) { this.val = val; this.next = next; }
 * }
 */
class Solution {
    public ListNode addTwoNumbers(ListNode first, ListNode second) {
        // Write your code here.
    }
}
Checking account…