Count Stepping Numbers In Range
Problem statement
A stepping number is an integer whose adjacent digits differ by exactly 1. Every one-digit integer, including 0, is a stepping number.
Given two integers low and high, return the number of stepping numbers in the inclusive range [low, high].
Function
countSteppingNumbers(low: long, high: long) → intExamples
Example 1
low = 0high = 21return = 13The stepping numbers in [0, 21] are 0 through 9, plus 10, 12, and 21.
Example 2
low = 10high = 15return = 2Only 10 and 12 are stepping numbers in [10, 15].
Constraints
0 <= low <= high <= 10^15.