Skip to main content

🟡 剑指 Offer II 098. 路径的数目

LeetCode 提示

题目难度 中等

原题链接 🔗 leetcode

题解1#

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