We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fcababd commit 5b0bed6Copy full SHA for 5b0bed6
unique-paths/hyer0705.ts
@@ -0,0 +1,11 @@
1
+function uniquePaths(m: number, n: number): number {
2
+ const dp: number[][] = Array.from({ length: m }, () => Array(n).fill(1));
3
+
4
+ for (let i = 1; i < m; i++) {
5
+ for (let j = 1; j < n; j++) {
6
+ dp[i][j] = dp[i - 1][j] + dp[i][j - 1];
7
+ }
8
9
10
+ return dp[m - 1][n - 1];
11
+}
0 commit comments