Digit sum 0 to n
Your task
Return the sum of the decimal digits of every integer from 0 to n inclusive. For n=12 the answer is 0+1+2+...+9+1+(1+0)+(1+1)+(1+2) = 51. 0 <= n <= 10^12. Use an approach that does not iterate over every integer.
Examples
digit_sum_upto(n: int) -> intExample 1
Input
digit_sum_upto(12)Output
51