class Solution {
public int climbStairs(int n) {
int[] is = new int[n + 1];
is[0] = 1;
is[1] = 1;
for (int i = 2; i <= n; i++) {
is[i] = is[i - 1] + is[i - 2];
}
return is[n];
}
}
image.png
网友评论