Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 2d6b38a

Browse files
added description at problem-25
1 parent cc34a14 commit 2d6b38a

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

‎problem-25.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,31 @@
1+
// Problem description
2+
/* You are given a large integer represented as an integer array digits, where each digits[i] is the ith digit of the integer. The digits are ordered from most significant to least significant in left-to-right order. The large integer does not contain any leading 0's.
3+
4+
Increment the large integer by one and return the resulting array of digits.
5+
6+
Example 1:
7+
8+
Input: digits = [1,2,3]
9+
Output: [1,2,4]
10+
Explanation: The array represents the integer 123.
11+
Incrementing by one gives 123 + 1 = 124.
12+
Thus, the result should be [1,2,4].
13+
Example 2:
14+
15+
Input: digits = [4,3,2,1]
16+
Output: [4,3,2,2]
17+
Explanation: The array represents the integer 4321.
18+
Incrementing by one gives 4321 + 1 = 4322.
19+
Thus, the result should be [4,3,2,2].
20+
Example 3:
21+
22+
Input: digits = [9]
23+
Output: [1,0]
24+
Explanation: The array represents the integer 9.
25+
Incrementing by one gives 9 + 1 = 10.
26+
Thus, the result should be [1,0]. */
27+
28+
// solution
129
let digits = [4, 3, 2, 1];
230

331
let plusOne = function (digits) {

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /