(int m, int n)
| 2 | |
| 3 | class Solution { |
| 4 | public int uniquePaths(int m, int n) { |
| 5 | int[][] dp = new int[m][n]; |
| 6 | |
| 7 | // First row |
| 8 | for (int j = 0; j < n; j++) { |
| 9 | dp[0][j] = 1; |
| 10 | } |
| 11 | |
| 12 | // First column |
| 13 | for (int i = 0; i < m; i++) { |
| 14 | dp[i][0] = 1; |
| 15 | } |
| 16 | |
| 17 | for (int i = 1; i < m; i++) { |
| 18 | for (int j = 1; j < n; j++) { |
| 19 | dp[i][j] = dp[i - 1][j] + dp[i][j - 1]; |
| 20 | } |
| 21 | } |
| 22 | |
| 23 | return dp[m - 1][n - 1]; |
| 24 | } |
| 25 | } |
nothing calls this directly
no outgoing calls
no test coverage detected