首页 > 其他分享 >LeetCode 70. Climbing Stairs

LeetCode 70. Climbing Stairs

时间:2022-10-18 14:00:49浏览次数:66  
标签:10005 return int Solution Climbing Stairs LeetCode dp

​题目​

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];

}
};



标签:10005,return,int,Solution,Climbing,Stairs,LeetCode,dp
From: https://blog.51cto.com/u_15834522/5766296

相关文章