youngyangyang04/leetcode-master-comment

[Vssue]0070.爬楼梯完全背包版本.md

youngyangyang04 opened this issue · 2 comments

class Solution {
    public int climbStairs(int n, int m) {
        int[] dp = new int[n + 1];
        dp[0] = 1;
        for (int j = 1; j <= n; j++) {
            for (int i = 1; i <= m; i++) {
                if (j - i >= 0) {
                    dp[j] += dp[j - i];
                }
            }
        }
        return dp[n];
    }
}