low, high, max_digit and a string ending: a positive number written without leading zeros.
A positive integer x **qualifies** if its decimal form ends with ending (the whole of x may equal ending) and every digit of x is at most max_digit.
Return how many qualifying integers lie in the range [low, high], both ends included.low=10, high=500, max_digit=3, ending="21" → 4
21, 121, 221 and 321 qualify: each ends in 21 and uses only digits up to 3. 421 is out because of its 4.
low=1, high=99, max_digit=9, ending="7" → 10
These are 7, 17, 27, ..., 97: ten numbers.
low=100, high=450, max_digit=5, ending="500" → 0
Any number ending in 500 is at least 500, but the range stops at 450.
highending uses only digits up to max_digit and does not start with zerolow=10, high=500, max_digit=3, ending="21"
4
Run checks the first 3 tests in your browser. Submit checks all 119 tests on the server, hidden ones included.