Digit Sums Divisible by K — Solution & Editorial
Digit DP with state = (position, digit-sum mod K, tight). Count over both bounds and subtract.
Complexity: O(digits · K · 10)
Digit DP with state = (position, digit-sum mod K, tight). Count over both bounds and subtract.
Complexity: O(digits · K · 10)