The stair has n steps. Every times you can up one or two steps. Give all the different solutions to upstairs.
For example n = 4.
sols = {[1,1,1,1],[1,1,2],[1,2,1],[2,2]}
n = 5
sols = {[1,1,1,1,1],[1,1,1,1,2],[1,1,2,1],[1,2,1,1],[1,2,2],[2,1,1,1],[2,1,2],[2,2,1]}
Have fun!
Solution Stats
Problem Comments
Solution Comments
Show comments
Loading...
Problem Recent Solvers9
Suggested Problems
-
Return the 3n+1 sequence for n
8540 Solvers
-
Get the area codes from a list of phone numbers
1078 Solvers
-
4659 Solvers
-
Project Euler: Problem 2, Sum of even Fibonacci
2929 Solvers
-
Chebyshev polynomials of the 2nd Kind
81 Solvers
More from this Author17
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!