62. Unique Paths#

 1public int uniquePaths(int m, int n) {
 2  int[][] dp = new int[m][n];
 3
 4  for (int i = 0; i < m; ++i) {
 5    for (int j = 0; j < n; ++j) {
 6      if (i == 0 || j == 0) {
 7        dp[i][j] = 1;
 8      } else {
 9        dp[i][j] = dp[i - 1][j] + dp[i][j - 1];
10      }
11    }
12  }
13  return dp[m - 1][n - 1];
14}