Sale!

Recursive Method to Traverse Staircase

Original price was: $35.00.Current price is: $30.00.

Category:
Rate this product

Recursive Method to Traverse Staircase
You’re given two positive integers representing the height of a staircase and the maximum number of steps that you can advance up the staircase at a time. Write a function that returns the number of ways in which you can climb the staircase.

For example, if you were given a staircase of height = 3 and maxSteps = 2 you could climb the staircase in 3 ways. You could take 1 step, 1 step, then 1 step, you could also take 1 step, then 2 steps, and you could take 2 steps, then 1 step.

Input format:
height = [The height of the staircase]
maxSteps = [The maximum number of steps you can take at a time]

Examples

Input:
4
2
Output:
5

Reviews

There are no reviews yet.

Be the first to review “Recursive Method to Traverse Staircase”

Your email address will not be published. Required fields are marked *

Scroll to Top