human
Print Nth Stepping or Autobiographical number | Function to find the Nth stepping natural number.
Declare the queue.
Enqueue 1 , 2 , ... , 9 in this order.
Perform K operation on queue.
Get the ith Stepping number.
Perform Dequeue from the Queue.
If x mod 10 is not equal to 0.
then Enqueue 10 x + ( x mod 10 ) - 1.
Enqueue 10 x + ( x mod 10 ).
If x mod 10 is not equal to 9.
then Enqueue 10 x + ( x mod 10 ) + 1.
Return the dequeued number of the K - th operation as the Nth stepping number.
Driver Code.
initialise K"
Solution in Python:
 Can you provide a code to print Nth Stepping or Autobiographical number and the other steps required?
assistant
#Here is code to print Nth Stepping or Autobiographical number and the other steps required.
 def NthSmallest ( K ) :
	Q = [ ]
	for i in range ( 1 , 10 ) :
		Q . append ( i )
	for i in range ( 1 , K + 1 ) :
		x = Q [ 0 ]
		Q . remove ( Q [ 0 ] )
		if ( x % 10 != 0 ) :
			Q . append ( x * 10 + x % 10 - 1 )
		Q . append ( x * 10 + x % 10 )
		if ( x % 10 != 9 ) :
			Q . append ( x * 10 + x % 10 + 1 )
	return x
if __name__ == ' _ _ main _ _ ' :
	N = 16
	print ( NthSmallest ( N ) )