028_爬楼梯

知识点:斐波那契、DP

LeetCode第七十题:https://leetcode-cn.com/problems/climbing-stairs/

语言:GoLang

func climbStairs(n int) int {
    a, b := 1, 1
    for i := 2; i <= n; i++ {
        tmp := b
        b = a + b
        a = tmp
    }
    return b
}
posted @ 2020-03-22 10:57  Cenyol  阅读(77)  评论(0)    收藏  举报