Plus One
Easy
Arrays
Array
Math
Given a number represented as array of digits, add one. Return the result as space-separated digits.
Constraints
1 ≤ digits.length ≤ 100
Examples
Example 1:
Input: 1 2 3
Output: 1 2 4
Example 2:
Input: 9 9 9
Output: 1 0 0 0
Tests:
Runtime:
Memory:
Test
Input:
Expected:
Got:
Click Run Code to test against sample cases, or Submit to test against all cases.
▲ Console