【Leetcode】Climbing Stairs
生活随笔
收集整理的這篇文章主要介紹了
【Leetcode】Climbing Stairs
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
題目鏈接:https://leetcode.com/problems/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?
思路:
上一步怎么走的跟下一步都的沒關系。用data數組表示到每一步為止,有多少種方法。
算法:
[java]? view plain copy
總結
以上是生活随笔為你收集整理的【Leetcode】Climbing Stairs的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 利用CSS背景定位实现列表项目符号图像的
- 下一篇: jot