Answered step by step
Verified Expert Solution
Question
1 Approved Answer
There are n stairs. A person is standing at the bottom and he wants to reach the top. The person can climb either 1,2, or
There are n stairs. A person is standing at the bottom and he wants to reach the top. The person can climb either 1,2, or 3 stairs at a time. The function below counts the number of ways that the person can reach the top.
def stairs(n):
if n <= 1: return n
else:
_______________ <-- line 5
Which of the following should be placed in line 4?
a)return stairs(3)
b)return stairs(n-1)
c)return stairs(n-1) + stairs(n-2)
d)return stairs(n-1) + stairs(n-2) + stairs(n-3)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started