Skip to main content
Back to problems
Leetcode
Medium
Linked Lists
Math
Recursion
Double a Number Represented as a Linked List

Double the non-negative integer stored in a linked list of digits and return the resulting list.

Acceptance 0%
Problem Statement

You are given the head of a singly linked list where each node contains a single decimal digit. The digits represent a non-negative integer in forward order, with the most significant digit at the head.

Return the head of a linked list representing the number obtained by doubling the original value.

The returned list should also store digits in forward order. If doubling creates a new most significant digit, include it in the result.

Input Format

  • A singly linked list head, where each node contains one digit 0 through 9.
  • The list represents a non-negative integer in forward order.

Output Format

  • Return the head of a singly linked list representing 2 × value(head) in forward order.

Constraints

  • The number of nodes is at least 1.
  • Each node contains a single digit from 0 to 9.
  • The input represents a valid non-negative integer with no leading zeros unless the number is zero itself.
  • The result may contain one extra digit due to carry.
Examples
Sample cases returned by the problem API.

Example 1

Input

head = [1,8,9]

Output

[3,7,8]

Explanation

189 doubled is 378, so the resulting linked list is [3,7,8].

Example 2

Input

head = [9,9,9]

Output

[1,9,9,8]

Explanation

999 doubled is 1998, which requires an extra leading digit.

Premium problem context

Unlock deeper context for this problem

Premium adds guided hints, editorial links, similar variants, discussion resources, and concept maps so you can understand why a problem matters, not just solve it once.

Guided hints
Editorial and discussion links
Concept map and variants
Sign in to unlock
Track your progress
Sign in to bookmark this problem, save notes, and manage its revision plan.