Total Digit Sum in a Range — Solution & Editorial
Digit DP returning a PAIR (count, sum-of-digitsums) per state: when placing digit d over c suffixes, it adds sum_suffix + d·c. Combine over both bounds.
Complexity: O(digits · 10)
Digit DP returning a PAIR (count, sum-of-digitsums) per state: when placing digit d over c suffixes, it adds sum_suffix + d·c. Combine over both bounds.
Complexity: O(digits · 10)