Answered step by step
Verified Expert Solution
Link Copied!

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Knowledge Discovery In Databases

Authors: Animesh Adhikari, Jhimli Adhikari

1st Edition

3319132121, 9783319132129

More Books

Students also viewed these Databases questions

Question

LO4 Identify a system for controlling absenteeism.

Answered: 1 week ago

Question

What does Processing of an OLAP Cube accomplish?

Answered: 1 week ago