Follow the computed execution on the reference input. Advance one step at a time, inspect the changing values and compare your prediction with the final output.
Example input
[
1,
9,
9
]
Execution steps
Propagate carry
Computed output
[
2,
0,
0
]
JavaScript reference implementation
const solve = (a,s)=>{
let c=1;
for(let i=a.length-1;
i>=0&&c;
i--){
let x=a[i]+c;
a[i]=x%10;
c=Math.floor(x/10);
s("Propagate carry",{
Digits:a,Carry:[c]
},[i])
}
if(c)a.unshift(c);
return a
};