How to count each digit in a range of integers?
There’s a clear mathematical solution to a problem like this. Let’s assume the value is zero-padded to the maximum number of digits (it’s not, but we’ll compensate for that later), and reason through it: From 0-9, each digit occurs once From 0-99, each digit occurs 20 times (10x in position 1 and 10x in position … Read more