摘要: 思路: 用f(x)表示爬到第x级台阶的方案数,最后一步可能跨了一级台阶,也可能跨了两级台阶, 所以状态转移方程式为f(x) = f(x - 1) + f(x - 2) 代码 class Solution { public int climbStairs(int n) { if(n <= 1){ re 阅读全文
posted @ 2021-03-30 16:44 yfy刷题 阅读(53) 评论(0) 推荐(0)