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

    return a[m - 1][n - 1];
    }
}

62. 不同路径

 

62. 不同路径

相关文章:

  • 2022-02-25
  • 2021-06-26
  • 2021-07-03
  • 2021-09-06
  • 2022-01-24
  • 2021-11-12
  • 2022-01-10
猜你喜欢
  • 2021-12-26
  • 2021-04-05
相关资源
相似解决方案