res
to store the stepping numbers within the range.low
is 0, append it to res
since 0 is a stepping number.cur
from the queue.
b. If cur
is within the range [low, high]
, append it to res
.
c. Get the last digit of cur
.
d. If the last digit is not 0, enqueue cur * 10 + last - 1
.
e. If the last digit is not 9, enqueue cur * 10 + last + 1
.res
.