Dodomeki
Sign in

69. Add Numbers in Lists

Medium

Each list represents a non-negative integer, with the least significant digit first. Add the two numbers and return the result in the same format. The lists may have different lengths; there are no leading zeros, except to represent zero.

Example 1
Input: a = [2, 4, 3], b = [5, 6, 4]
Output: [7, 0, 8]
Example 2
Input: a = [9, 9], b = [1]
Output: [0, 0, 1]
Constraints
  • 1 <= tamanho de cada lista <= 10000
  • Cada nó contém um dígito entre 0 e 9.
Linked listMath
Caso 1
a =
[2,4,3]
b =
[5,6,4]
Expected =
[7,0,8]
Caso 2
a =
[9,9]
b =
[1]
Expected =
[0,0,1]

Run checks these 2 cases. Submit runs all 6, including hidden ones.