Climbing the stairs - MATLAB Cody - MATLAB Central

Problem 47154. Climbing the stairs

Difficulty:Rate
The number of steps in the staircase are given as n. You can climb atmost 3 steps at a time.
Output the number of ways you can climb the stairs modulo (10^9 + 7).
Example:
if n = 1, output = 1, because ways of climbing = { (1) }
if n = 2, output = 2, because ways of climbing = {(1,1), (2)}
if n = 3, output = 4, because ways of climbing = { (1,1,1), (1,2), (2,1), (3) }
Hint : refer tags

Solution Stats

19.23% Correct | 80.77% Incorrect
Last Solution submitted on Oct 09, 2022

Solution Comments

Show comments
Who Deserves Your Praise? Discover the New Contribution Widget!
...
We are excited to announce another update to our Discussions area: the...

Problem Recent Solvers5

Suggested Problems

More from this Author5

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Go to top of page