digits, one digit per element, from the most significant to the least significant. For instance, 4096 is stored as [4, 0, 9, 6].
You are also given an integer amount. Return the sum of the two numbers in the same format: an array of digits, most significant first.digits=[3, 0, 7], amount=95 → [4, 0, 2]
307 + 95 = 402.
digits=[9, 9], amount=1 → [1, 0, 0]
99 + 1 = 100: the answer has one more digit.
digits=[0], amount=4200 → [4, 2, 0, 0]
0 + 4200 = 4200, longer than the original array.
digits.length ≤ 2·10⁵digits[i] ≤ 9digits has no leading zeros, except for the number 0 itselfamount ≤ 10⁹digits=[3, 0, 7], amount=95
[4, 0, 2]
Run checks the first 3 tests in your browser. Submit checks all 50 tests on the server, hidden ones included.