Tap here to switch tabs
Problem
Submissions

Problem: Add Two Numbers II

Add Two Numbers II represents two non-negative integers as linked lists with digits in forward order. Return their sum as a linked list in the same order.

Statement

You are given two non empty singly linked lists l1 and l2 that represent two non negative integers. Each node stores a single digit in Node.val, and the digits are ordered from most significant to least significant.

Return the sum of the two numbers as a singly linked list in the same most significant to least significant digit order.

Note: Follow up: can you solve this without reversing the input lists?

Constraints:

  • The number of nodes in each of l1 and l2 is in the range [1,100][1, 100].

  • 0≤0 \leq Node.val ≤9\leq 9.

  • Each list represents a number with no leading zeros.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Add Two Numbers II

Add Two Numbers II represents two non-negative integers as linked lists with digits in forward order. Return their sum as a linked list in the same order.

Statement

You are given two non empty singly linked lists l1 and l2 that represent two non negative integers. Each node stores a single digit in Node.val, and the digits are ordered from most significant to least significant.

Return the sum of the two numbers as a singly linked list in the same most significant to least significant digit order.

Note: Follow up: can you solve this without reversing the input lists?

Constraints:

  • The number of nodes in each of l1 and l2 is in the range [1,100][1, 100].

  • 0≤0 \leq Node.val ≤9\leq 9.

  • Each list represents a number with no leading zeros.