Tap here to switch tabs
Problem
Submissions

Problem: Count Stepping Numbers in Range

Count Stepping Numbers in Range asks you to count integers between two integer strings whose adjacent digits differ by one. Include single-digit numbers and return the count modulo a large prime.

Statement

Given two positive integer strings low and high, return the number of stepping numbers in the inclusive range [[low, high]]. Since the answer may be large, return it modulo 109+710^9 + 7.

A stepping number is an integer where the absolute difference between any two adjacent digits is exactly 11. Every single digit number is also considered a stepping number.

Constraints:

  • 1≤1 \leq int(low) ≤\leq int(high) <10100< 10^{100}

  • 1≤1 \leq low.length, high.length ≤100\leq 100

  • low and high consist of only digits.

  • low and high do not have any leading zeros.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Count Stepping Numbers in Range

Count Stepping Numbers in Range asks you to count integers between two integer strings whose adjacent digits differ by one. Include single-digit numbers and return the count modulo a large prime.

Statement

Given two positive integer strings low and high, return the number of stepping numbers in the inclusive range [[low, high]]. Since the answer may be large, return it modulo 109+710^9 + 7.

A stepping number is an integer where the absolute difference between any two adjacent digits is exactly 11. Every single digit number is also considered a stepping number.

Constraints:

  • 1≤1 \leq int(low) ≤\leq int(high) <10100< 10^{100}

  • 1≤1 \leq low.length, high.length ≤100\leq 100

  • low and high consist of only digits.

  • low and high do not have any leading zeros.