Problem
A large non-negative integer is stored as a list of digits, most significant first, with no leading zeros (except the number 0 itself). Add one to it and return the new list of digits.
Example 1
- Input
- digits = [1, 2, 3]
- Output
- [1, 2, 4]
Example 2
- Input
- digits = [1, 9, 9]
- Output
- [2, 0, 0]
Example 3
- Input
- digits = [9, 9, 9]
- Output
- [1, 0, 0, 0]
Constraints
1 <= digits.length <= 1000 <= digits[i] <= 9digits has no leading zeros, except for the number 0 itself.