Work out how many steps it will take you to climb a flight of stairs You are walking up a fixed number of steps to get to the top of the staircase. Each time, you can climb one or two steps. Calculate the number of distinct ways you can climb to the top. API • climbstairs (numberofSteps) • Takes in the number of steps there are in this staircase Returns the total distinct ways you can climb to the top

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter6: Modularity Using Functions
Section: Chapter Questions
Problem 10PP
icon
Related questions
Question

JavaScript Practice Question

Work out how many steps it will take you to climb a flight of stairs
You are walking up a fixed number of steps to get to the top of the staircase. Each time, you can
climb one or two steps. Calculate the number of distinct ways you can climb to the top.
API
climbstairs (numberofSteps)
• Takes in the number of steps there are in this staircase
Returns the total distinct ways you can climb to the top
Constraints
numberOfSteps will never be less than 1 or greater than 20
Examples
climbstairs (2)
climbStairs (3) = 3
= 2
Transcribed Image Text:Work out how many steps it will take you to climb a flight of stairs You are walking up a fixed number of steps to get to the top of the staircase. Each time, you can climb one or two steps. Calculate the number of distinct ways you can climb to the top. API climbstairs (numberofSteps) • Takes in the number of steps there are in this staircase Returns the total distinct ways you can climb to the top Constraints numberOfSteps will never be less than 1 or greater than 20 Examples climbstairs (2) climbStairs (3) = 3 = 2
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Module hierarchy chart
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Operations Research : Applications and Algorithms
Operations Research : Applications and Algorithms
Computer Science
ISBN:
9780534380588
Author:
Wayne L. Winston
Publisher:
Brooks Cole