PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCareers
|Home/Coding & Algorithms/Google

Add two big integers from digit lists

Last updated: Mar 29, 2026

Quick Overview

This question evaluates algorithmic skills in manipulating linked lists or arrays to perform addition of large integers, focusing on carry propagation, handling differing lengths, and analysis of time and space complexity.

  • medium
  • Google
  • Coding & Algorithms
  • Software Engineer

Add two big integers from digit lists

Company: Google

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

You are given two non-empty singly linked lists (or arrays) representing two non-negative integers. The digits are stored in **reverse order**, and each node contains a single digit from 0 to 9. Your task is to add the two numbers and return the sum as a new linked list, also in reverse order. You may assume: - Each list has at least one node. - The integers do not contain leading zeros, except the number 0 itself. ### Example Input: - List 1: 2 → 4 → 3 (represents the integer 342) - List 2: 5 → 6 → 4 (represents the integer 465) Output: - 7 → 0 → 8 (represents the integer 807, since 342 + 465 = 807) ### Another example Input: - List 1: 9 → 9 → 9 (represents 999) - List 2: 1 (represents 1) Output: - 0 → 0 → 0 → 1 (represents 1000) ### Constraints - Let n be the length of the first list and m be the length of the second list. - 1 ≤ n, m ≤ 10^5. - Each node value is an integer in the range [0, 9]. **Task:** Describe an algorithm to perform this addition and construct the resulting linked list in O(n + m) time and O(1) additional space (excluding the space for the output list).

Quick Answer: This question evaluates algorithmic skills in manipulating linked lists or arrays to perform addition of large integers, focusing on carry propagation, handling differing lengths, and analysis of time and space complexity.

Related Interview Questions

  • Compute Turnstile Crossing Times - Google (hard)
  • Simulate In-Place Cellular State Updates - Google (hard)
  • Determine Whether a Word Exists in a Graph - Google (medium)
  • Solve Shortest Paths and Rental Allocation - Google (medium)
  • Solve Two Array Optimization Problems - Google (medium)
Google logo
Google
Nov 24, 2025, 12:00 AM
Software Engineer
Technical Screen
Coding & Algorithms
6
0

You are given two non-empty singly linked lists (or arrays) representing two non-negative integers. The digits are stored in reverse order, and each node contains a single digit from 0 to 9.

Your task is to add the two numbers and return the sum as a new linked list, also in reverse order.

You may assume:

  • Each list has at least one node.
  • The integers do not contain leading zeros, except the number 0 itself.

Example

Input:

  • List 1: 2 → 4 → 3 (represents the integer 342)
  • List 2: 5 → 6 → 4 (represents the integer 465)

Output:

  • 7 → 0 → 8 (represents the integer 807, since 342 + 465 = 807)

Another example

Input:

  • List 1: 9 → 9 → 9 (represents 999)
  • List 2: 1 (represents 1)

Output:

  • 0 → 0 → 0 → 1 (represents 1000)

Constraints

  • Let n be the length of the first list and m be the length of the second list.
  • 1 ≤ n, m ≤ 10^5.
  • Each node value is an integer in the range [0, 9].

Task: Describe an algorithm to perform this addition and construct the resulting linked list in O(n + m) time and O(1) additional space (excluding the space for the output list).

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Google•More Software Engineer•Google Software Engineer•Google Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • Careers
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.