housemeow / Leetcode

4 stars 2 forks source link

70. Climbing Stairs #52

Open housemeow opened 3 years ago

housemeow commented 3 years ago

https://leetcode.com/problems/climbing-stairs

Agby commented 3 years ago

想法: 費氏數列那一套

Agby commented 3 years ago

因為一次只能爬 1 或 2 所以能爬到 50 的 就是 能爬到 49 的總次數(+1) + 48 的總次數(+2) 順著這個推 就跟 fib 那個一樣。