Plus one
Easyarraymath
A large number is stored as an array of digits, most significant first ([1,2,3] = 123). Add one and return the new array.
Example 1
Input: digits = [1,2,3] Output: [1,2,4]
Example 2
Input: digits = [9] Output: [1,0]
Constraints
- 1 ≤ digits.length ≤ 100
- No leading zeros except the number 0
Submit checks your solution against 7 tests, including hidden ones.
/**
* @param {int[]} digits
* @return {int[]}
*/
function plusOne(digits) {
}