Skip to content

Latest commit

 

History

History

Number of N Digit(s) Stepping Numbers

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Given n, find count of n digit Stepping numbers. A number is called stepping number if all adjacent digits have an absolute difference of 1. 321 is a Stepping Number while 421 is not.

Input : 2 
Output : 17
Explanation: The numbers are 10, 12, 21, 
23, 32, 34, 43, 45, 54, 56, 65, 67, 76, 
78, 87, 89, 98.

Input : 1
Output : 10
Explanation: the numbers are 0, 1, 2, 3, 
4, 5, 6, 7, 8, 9.