You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# [989. Add to Array-Form of Integer](https://leetcode.com/problems/add-to-array-form-of-integer/)
2
+
3
+
## 题目
4
+
5
+
For a non-negative integer `X`, the *array-form of `X`* is an array of its digits in left to right order. For example, if `X = 1231`, then the array form is `[1,2,3,1]`.
6
+
7
+
Given the array-form `A` of a non-negative integer `X`, return the array-form of the integer `X+K`.
8
+
9
+
**Example 1:**
10
+
11
+
```
12
+
Input: A = [1,2,0,0], K = 34
13
+
Output: [1,2,3,4]
14
+
Explanation: 1200 + 34 = 1234
15
+
```
16
+
17
+
**Example 2:**
18
+
19
+
```
20
+
Input: A = [2,7,4], K = 181
21
+
Output: [4,5,5]
22
+
Explanation: 274 + 181 = 455
23
+
```
24
+
25
+
**Example 3:**
26
+
27
+
```
28
+
Input: A = [2,1,5], K = 806
29
+
Output: [1,0,2,1]
30
+
Explanation: 215 + 806 = 1021
31
+
```
32
+
33
+
**Example 4:**
34
+
35
+
```
36
+
Input: A = [9,9,9,9,9,9,9,9,9,9], K = 1
37
+
Output: [1,0,0,0,0,0,0,0,0,0,0]
38
+
Explanation: 9999999999 + 1 = 10000000000
39
+
```
40
+
41
+
**Note:**
42
+
43
+
1.`1 <= A.length <= 10000`
44
+
2.`0 <= A[i] <= 9`
45
+
3.`0 <= K <= 10000`
46
+
4. If `A.length > 1`, then `A[0] != 0`
47
+
48
+
## 题目大意
49
+
50
+
对于非负整数 X 而言,X 的数组形式是每位数字按从左到右的顺序形成的数组。例如,如果 X = 1231,那么其数组形式为 [1,2,3,1]。给定非负整数 X 的数组形式 A,返回整数 X+K 的数组形式。
# [989. Add to Array-Form of Integer](https://leetcode.com/problems/add-to-array-form-of-integer/)
2
+
3
+
## 题目
4
+
5
+
For a non-negative integer `X`, the *array-form of `X`* is an array of its digits in left to right order. For example, if `X = 1231`, then the array form is `[1,2,3,1]`.
6
+
7
+
Given the array-form `A` of a non-negative integer `X`, return the array-form of the integer `X+K`.
8
+
9
+
**Example 1:**
10
+
11
+
```
12
+
Input: A = [1,2,0,0], K = 34
13
+
Output: [1,2,3,4]
14
+
Explanation: 1200 + 34 = 1234
15
+
```
16
+
17
+
**Example 2:**
18
+
19
+
```
20
+
Input: A = [2,7,4], K = 181
21
+
Output: [4,5,5]
22
+
Explanation: 274 + 181 = 455
23
+
```
24
+
25
+
**Example 3:**
26
+
27
+
```
28
+
Input: A = [2,1,5], K = 806
29
+
Output: [1,0,2,1]
30
+
Explanation: 215 + 806 = 1021
31
+
```
32
+
33
+
**Example 4:**
34
+
35
+
```
36
+
Input: A = [9,9,9,9,9,9,9,9,9,9], K = 1
37
+
Output: [1,0,0,0,0,0,0,0,0,0,0]
38
+
Explanation: 9999999999 + 1 = 10000000000
39
+
```
40
+
41
+
**Note:**
42
+
43
+
1.`1 <= A.length <= 10000`
44
+
2.`0 <= A[i] <= 9`
45
+
3.`0 <= K <= 10000`
46
+
4. If `A.length > 1`, then `A[0] != 0`
47
+
48
+
## 题目大意
49
+
50
+
对于非负整数 X 而言,X 的数组形式是每位数字按从左到右的顺序形成的数组。例如,如果 X = 1231,那么其数组形式为 [1,2,3,1]。给定非负整数 X 的数组形式 A,返回整数 X+K 的数组形式。
|0211|Design Add and Search Words Data Structure|[Go]({{< relref "/ChapterFour/0211.Design-Add-and-Search-Words-Data-Structure.md" >}})|Medium| O(n)| O(n)|❤️|39.8%|
0 commit comments