Skip to content

Commit 738a55d

Browse files
add 066 [js]
1 parent 183c81a commit 738a55d

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

solution/066.Plus One/Solution.js

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
const plusOne = function(digits){
2+
for(let i = digits.length - 1; i >= 0; i--){
3+
if(digits[i] === 9){
4+
digits[i] = 0;
5+
}else{
6+
digits[i] += 1;
7+
return digits;
8+
}
9+
}
10+
digits.unshift(1);
11+
return digits;
12+
};

0 commit comments

Comments
 (0)