[리트코드] 39. Combination Sum
39. Combination Sum
나의 풀이
/**
* @param {number} m
* @param {number} n
* @return {number}
*/
var uniquePaths = function (m, n) {
const map = Array.from(Array(m), () => Array(n).fill(1));
for (let i = 1; i < m; i++) {
for (let j = 1; j < n; j++) {
map[i][j] = map[i - 1][j] + map[i][j - 1];
}
}
return map[m - 1][n - 1];
};
console.log(uniquePaths(3, 7));
Runtime: 109 ms, faster than 9.42% of JavaScript online submissions for Unique Paths