Description
Count how many occurrences there are of the digit 1 between two given numbers \$[a, b]\$, inclusive.
For example, from 1 to 100 it should be 21:
1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 21, 31, 41, 51, 61, 71, 81, 91, 100
The number 1 is repeated 2021 times.
Rules
- Each number in the input list is guaranteed is an integer in the range \$0 \leq a \leq b < 2^{32}\$.
- The shortest answer in bytes wins.
Test cases
[1, 100] -> 21
[11, 200] -> 138
[123, 678] -> 182
Example
Here is my code using bash
eval echo {$1..$2}|grep -o 1|wc -l