4565 and 10 are ladder numbers, while 122 and 135 are not. Every single-digit number counts as a ladder number too.
The ends of the range are given as strings lo and hi, since they can be very long. Count the ladder numbers from lo to hi, both ends included. Numbers are written without leading zeros.
The answer can be huge, so return it modulo 10⁹ + 7.lo="8", hi="23" → 6
The ladder numbers here are 8, 9, 10, 12, 21 and 23, six in total. 11 fails because its digits are equal, and 20 fails because 2 and 0 differ by 2.
lo="300", hi="345" → 4
Within the range, only 321, 323, 343 and 345 are ladder numbers.
lo="1", hi="9" → 9
lo and hi contain only digits and do not start with zerolo="8", hi="23"
6
Run checks the first 3 tests in your browser. Submit checks all 103 tests on the server, hidden ones included.