lo and hi and a number divisor. Count the numbers in the range [lo, hi] that are balanced and also divisible by divisor.
The bounds reach 10⁹, so checking every number in the range is not an option.lo=30, hi=50, divisor=7 → 1
The multiples of 7 in range are 35, 42 and 49. Both digits of 35 are odd, both of 42 are even, while 49 has one even and one odd digit. The answer is 1.
lo=100, hi=999, divisor=1 → 0
A three-digit number has an odd number of digits, so they cannot split evenly.
lo=1000, hi=1100, divisor=5 → 11
lo=30, hi=50, divisor=7
1
Run checks the first 3 tests in your browser. Submit checks all 100 tests on the server, hidden ones included.