lo to hi inclusive in ordinary decimal form, with no leading zeros. How many times does the digit digit appear among all the characters you wrote?
Every occurrence counts, even within one number: 22 contains the digit 2 twice.
Checking every number is too slow here, since the range can span hundreds of millions of numbers.digit=2, lo=18, hi=23 → 5
The digit 2 appears in 20, 21, 22 (twice) and 23: 5 in total.
digit=0, lo=1, hi=30 → 3
Zeros appear only in 10, 20 and 30. Leading zeros are not written, so 7 does not count as 07.
digit=2, lo=18, hi=23
5
Run checks the first 3 tests in your browser. Submit checks all 102 tests on the server, hidden ones included.