作者:mobiledu2502894873 | 来源:互联网 | 2023-09-01 20:38
ClimbingStairs Youareclimbingastaircase.Ittakesnstepstoreachtothe
Climbing Stairs
You are climbing a stair case. It takes n steps to reach to the top.
Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?
Hide Tags
Dynamic Programming
这个题面试题还是比较常见的
讨论的帖子:
https://leetcode.com/discuss/2809/easy-solutions-for-suggestions
DP算法求解:
https://leetcode.com/discuss/16275/my-dp-solution-using-c-4-ms
简洁的代码:
https://leetcode.com/discuss/31848/1ms-in-c-and-2ms-in-c-optimal-space-no-temp-value
递归:
https://leetcode.com/discuss/28383/simple-and-clear-2ms-solution-in-c-without-recursion
python:
https://leetcode.com/discuss/25378/this-is-essentially-a-fibonacci-sequence
leetcode 70 Climbing Stairs