The array-form of an integer is the array of its digits from left to right, for example 1321 is [1,3,2,1]. Given the array-form num of an integer and an integer k, return the array-form of num + k.
The array-form of an integer is the array of its digits from left to right, for example 1321 is [1,3,2,1]. Given the array-form num of an integer and an integer k, return the array-form of num + k.
Example 1:
Input: {"num":[1,2,0,0],"k":34}
Output: [1,2,3,4]
Constraints:
1≤num.length≤104
0≤num[i]≤9
num has no leading zeros except for the number 0 itself.
1≤k≤104
Test Cases
Input (Stdin)
Expected Output (Stdout)
Execution Result
Run code to see results.
Input
arr ={"num":[1,2,0,0],"k":34}
Add k = 34 to the number written as [1,2,0,0]. k itself will act as the carry.