题目

class Solution {
public:
    int dp[10005];
    int climbStairs(int n) {
        
        dp[1]=1;
        dp[2]=2;
        
        for(int i=3;i<=n;i++)
        {
            dp[i]=dp[i-1]+dp[i-2];
        }
        
        return dp[n];
        
    }
};

相关文章:

  • 2021-07-13
  • 2021-10-29
  • 2021-10-21
  • 2021-12-08
  • 2021-10-08
  • 2022-12-23
猜你喜欢
  • 2021-07-23
  • 2021-08-06
  • 2022-01-04
  • 2022-01-27
  • 2022-01-27
  • 2021-10-05
相关资源
相似解决方案