题目链接:点击打开链接
题目大意:略。
解题思路:略。
相关企业
- 字节跳动
- 微软(Microsoft)
- 谷歌(Google)
- 彭博(Bloomberg)
- 腾讯(Tencent)
- 苹果(Apple)
- 高盛集团(Goldman Sachs)
- 亚马逊(Amazon)
AC 代码
class Solution {
public int climbStairs(int n) {
if (n == 0) return 1;
int[] dp = new int[n + 1];
dp[0] = dp[1] = 1;
for (int i = 2; i <= n; i++) {
dp[i] = dp[i - 1] + dp[i - 2];
}
return dp[n];
}
}