human
Write me a code to print all ways to reach the Nth stair with the jump of 1 or 2 units at a time and the other steps required given the following:
Print all ways to reach the Nth stair with the jump of 1 or 2 units at a time | Function to find all the ways to reach Nth stair using one or two jumps.
Base Cases.
Recur for jump1 and jump2.
Stores the total possible jumps.
Add "1" with every element present in jump1.
Add "2" with every element present in jump2.
Driver Code"
Solution in Python:
assistant
#Here is code to print all ways to reach the Nth stair with the jump of 1 or 2 units at a time and the other steps required.
 def TotalPossibleJumps ( N ) :
	if ( ( N - 1 ) == 0 ) :
		newvec = [ ]
		newvec . append ( " " )
		return newvec
	else :
		if ( N < 0 ) :
			newvec = [ ]
			return newvec
	jump1 = TotalPossibleJumps ( N - 1 )
	jump2 = TotalPossibleJumps ( N - 2 )
	totaljumps = [ ]
	for s in jump1 :
		totaljumps . append ( "1" + s )
	for s in jump2 :
		totaljumps . append ( "2" + s )
	return totaljumps
if __name__ == " _ _ main _ _ " :
	N = 3
	Ans = TotalPossibleJumps ( N )
	for it in Ans :
		print ( it )