We’re preparing your current view and syncing the latest data.
The array-form of an integer num is an array representing its digits in left to right order.
Given the array-form num, and an integer K, return the array-form of the integer num + K.
Example: Input: num = [1,2,0,0], K = 34 Output: [1,2,3,4] Explanation: 1200 + 34 = 1234
num: integer array representing the digits of a number K: integer to be added
integer array representing the digits of the sum num + K
1 <= num.length <= 10^4 0 <= num[i] <= 9 num does not contain leading zeros except for the number 0 itself 1 <= K <= 10^4
Example 1
Input
num = [1,2,0,0], K = 34
Output
[1,2,3,4]
Explanation
1200 + 34 = 1234
Example 2
Input
num = [2,7,4], K = 181
Output
[4,5,5]
Explanation
274 + 181 = 455
Example 3
Input
num = [2,1,5], K = 806
Output
[1,0,2,1]
Explanation
215 + 806 = 1021
Example 4
Input
num = [9,9,9,9,9,9,9,9,9,9], K = 1
Output
[1,0,0,0,0,0,0,0,0,0,0]
Explanation
9999999999 + 1 = 10000000000