low and high written as strings (they can be very long), and two integers min_total and max_total.
Count the integers x with low ≤ x ≤ high whose digit sum is between min_total and max_total, inclusive. The count can be large, so return it modulo 10⁹ + 7.low="5", high="21", min_total=3, max_total=5 → 5
The digit sum is between 3 and 5 for 5, 12, 13, 14 and 21. For example, 11 and 20 have a digit sum of 2, which is too small. The answer is 5.
low="1", high="100", min_total=10, max_total=10 → 9
Exactly 10 is the digit sum of 19, 28, 37, 46, 55, 64, 73, 82 and 91: nine numbers.
low="999", high="1001", min_total=1, max_total=2 → 2
999 has a digit sum of 27, 1000 has 1 and 1001 has 2. The last two fit.
low and high are decimal strings without leading zeros, at most 60 digits longlow="5", high="21", min_total=3, max_total=5
5
Run checks the first 3 tests in your browser. Submit checks all 87 tests on the server, hidden ones included.