question link=>
class Solution {
public List<Integer> addToArrayForm(int[] num, int k) {
List<Integer> ans= new ArrayList<>();
long n=0;
for(int i:num){
n = (n*10)+i;
}
n+=k;
while(n>0){
ans.add(0,(int)n%10);
n/=10;
}
return ans;
}
}
Input
[9,9,9,9,9,9,9,9,9,9]
1
Output
[1,0,0,0,0,0,0,0,0,0,8]
Expected
[1,0,0,0,0,0,0,0,0,0,0]