We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent bf100c9 commit 27477faCopy full SHA for 27477fa
scripts/algorithms/U/Unique Paths/Unique Paths.js
@@ -1,11 +1,12 @@
1
+// Runtime: 62 ms (Top 95.54%) | Memory: 42.3 MB (Top 53.45%)
2
var uniquePaths = function(m, n) {
3
let count = Array(m)
- for(let i=0; i<m; i++) count[i] = Array(n)
4
+ for(let i=0; i<m; i++) count[i] = Array(n)
5
for(let i=0; i<m; i++){
6
for(let j=0; j<n; j++){
- if(i == 0 || j == 0) count[i][j] = 1
7
- else count[i][j] = count[i][j-1] + count[i-1][j]
+ if(i == 0 || j == 0) count[i][j] = 1
8
+ else count[i][j] = count[i][j-1] + count[i-1][j]
9
}
10
11
return count[m-1][n-1]
-};
12
+};
0 commit comments