70. 爬楼梯

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

你可能感兴趣的:(70. 爬楼梯)