FastPrepAdd Numbers in Forward-Order Lists
Problems/Add Numbers in Forward-Order Lists

Add Numbers in Forward-Order Lists

Expedia logoExpedia● MediumNEW GRADONSITE INTERVIEW

Updated Oct 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The source reports adding numbers represented by linked lists. Most-significant-digit-first order, decimal digit bounds and nonempty inputs complete the practice variant. Estimated match90%.

Each nonempty linked list represents a nonnegative decimal integer, with its most significant digit first and one digit per node. Return a linked list representing their sum in the same order.

There are no leading zeroes except the single-node representation [0]. The returned number must use that same convention.

Function

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

Examples

Example 1

first = [7,2,4,3]second = [5,6,4]return = [7,8,0,7]
first
7243
second
564
return
7807

7243+564=7807.

Example 2

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

Zero plus zero is represented by one zero node.

Constraints

  • 1 <= first.length, second.length <= 500.
  • 0 <= first[i], second[i] <= 9.
  • Both inputs are acyclic lists with no leading zero, unless the list consists only of one zero.

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
  • Min StackCapital One · PHONE SCREEN · ONSITE INTERVIEWCapital One interview questions
  • Max StackLinkedIn · ONSITE INTERVIEWLinkedIn interview questions
  • Max StackZipline · ONSITE INTERVIEW
  • Turn a BST Into a Sorted Doubly Linked ListAdobe · PHONE SCREENAdobe interview questions
  • Add Forward Linked-List Numbers Using RecursionPeopleStrong · PHONE SCREENPeopleStrong interview questions
  • Reverse a Sublist of a Linked ListSalesforce · ONSITE INTERVIEWSalesforce interview questions
  • LRU CacheLotusFlare · ONSITE INTERVIEW
  • LRU Cache for Query ResultsAmazon · PHONE SCREEN · ONSITE INTERVIEW

Interview reports that mention this question

  • Expedia New Grad SDE Interviews: 20 Experiences (Part 1 of 3)

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 Intern Final Round in 2022: 15 Experiences (Part 3 of 6)
  • Expedia Intern Final Round in 2023: 17 Experiences (Part 2 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 addNumbers(ListNode first, ListNode second) {
        // Write your code here.
    }

}
Checking account…