Given an array of digits that represents a number, add 1 to the number. Suppose an array containing the elements [1, 2, 3, 4]
. Thus, the array represents the decimal number 1,234.
Input : [1, 2, 3, 4]
Output : [1, 2, 3, 5]
Input : [1, 2, 9, 9]
Output : [1, 3, 0, 0]
Input: [9, 9, 9, 9]
Output: [1, 0, 0, 0, 0]