human
Number of n digit stepping numbers | Space optimized solution | function that calculates the answer.
dp [ j ] stores count of i digit stepping numbers ending with digit j ..
To store resu1lt of length i - 1 before updating dp [ j ] for length i ..
if n is 1 then answer will be 10..
Initialize values for count of digits equal to 1..
Compute values for count of digits more than 1..
If ending digit is 0.
If ending digit is 9.
For other digits ..
stores the final answer.
Driver Code"
Solution in Python:

=====
Give me a code to number of n digit stepping numbers and the other steps required?
assistant
#Here is code to number of n digit stepping numbers and the other steps required.
 def answer ( n ) :
	dp = [ 0 ] * 10
	prev = [ 0 ] * 10
	if ( n == 1 ) :
		return 10
	for j in range ( 0 , 10 ) :
		dp [ j ] = 1
	for i in range ( 2 , n + 1 ) :
		for j in range ( 0 , 10 ) :
			prev [ j ] = dp [ j ]
		for j in range ( 0 , 10 ) :
			if ( j == 0 ) :
				dp [ j ] = prev [ j + 1 ]
			elif ( j == 9 ) :
				dp [ j ] = prev [ j - 1 ]
			else :
				dp [ j ] = prev [ j - 1 ] + prev [ j + 1 ]
	sum = 0
	for j in range ( 1 , 10 ) :
		sum = sum + dp [ j ]
	return sum
n = 2
print ( answer ( n ) )