|
1 | | -/** |
| 1 | +/* |
2 | 2 | * A Dynamic Programming based solution for calculating the number ways to travel from Top-Left of the matrix to Bottom-Right of the matrix
|
3 | 3 | * https://leetcode.com/problems/unique-paths/
|
| 4 | + * Problem Statement: |
| 5 | + * There is a robot on an m x n grid. The robot is initially located at the top-left corner (i.e., grid[0][0]). The robot tries to move to the bottom-right corner (i.e., grid[m - 1][n - 1]). The robot can only move either down or right at any point in time. |
| 6 | + * Given the two integers m and n, return the number of possible unique paths that the robot can take to reach the bottom-right corner. |
| 7 | + * Approach: |
| 8 | + * As the given problem can be reduced to smaller and overlapping sub problems, we can use dynamic programming and memoization to solve this problem. |
| 9 | + * Time complexity: O(M * N) (M->ROWS | N->COLS) |
| 10 | + * Space complexity: O(M * N) (M->ROWS | N->COLS) |
| 11 | + */ |
| 12 | + |
| 13 | +/** |
| 14 | + * @param {number} rows |
| 15 | + * @param {number} cols |
| 16 | + * @return {number} |
4 | 17 | */
|
5 | 18 |
|
6 | 19 | // Return the number of unique paths, given the dimensions of rows and columns
|
|
0 commit comments