We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
62. 不同路径
The text was updated successfully, but these errors were encountered:
/* * @lc app=leetcode.cn id=62 lang=javascript * * [62] 不同路径 */ // @lc code=start /** * @param {number} m * @param {number} n * @return {number} (56 ms) */ var uniquePaths = function(m, n) { let dp = new Array(m).fill(0).map(v => new Array(n).fill(0)); dp[0][0] = 1; for(let i = 0; i < m; i++) { for(let j = 0; j < n; j++) { // 起始 if(i === 0 && j === 0) continue; // 不越界 let top = i <= 0 ? 0 : dp[i-1][j]; let left = j <= 0 ? 0 : dp[i][j-1]; dp[i][j] = top + left; } } return dp[m-1][n-1] }; // @lc code=end
Sorry, something went wrong.
No branches or pull requests
62. 不同路径
The text was updated successfully, but these errors were encountered: