You are viewing a single comment's thread. Return to all comments →
Could you please explain the approach and why we are doing:
d[j + 1] += d[j] / 10;
d[j] %= 10;
He used the math multiplication method we used everyday when it's come to multiply two more-than-one-digit number:
abc * ef = abc * e * 10 + abc * f .
His approach is based on that but he's done it reversely.
The way he did it is really clever!