Stepping Numbers

Given N and M find all stepping numbers in range N to M

The stepping number:

A number is called as a stepping number if the adjacent digits have a difference of 1.
e.g 123 is stepping number, but 358 is not a stepping number


N = 10, M = 20
all stepping numbers are 10 , 12 

Return the numbers in sorted order.

Interview Code Editor
  • Hint 1
  • Solution Approach
  • Complete Solution
2180 successful submissions.
Asked In:
  • Epic systems
Click here to jump start your coding interview preparation