d
between 0
and 9
, and two positive
integers low
and high
as lower and upper bounds, respectively. Return
the number of times that d
occurs as a digit in all integers between
low
and high
, including the bounds low
and
high
.
Example 1:
Input: d = 1, low = 1, high = 13 Output: 6 Explanation: The digitd=1
occurs6
times in1,10,11,12,13
. Note that the digitd=1
occurs twice in the number11
.
Example 2:
Input: d = 3, low = 100, high = 250 Output: 35 Explanation: The digitd=3
occurs35
times in103,113,123,130,131,...,238,239,243
.
Note:
0 <= d <= 9
1 <= low <= high <= 2×10^8