LeetCode 62. Unique Paths
作者:互联网
这是一道迷宫题目,其实很简单就是简单的动态规划题
class Solution {
public:
int dp[105][105];
int uniquePaths(int m, int n) {
for(int i=0;i<n;i++)
{
for(int j=0;j<m;j++)
{
if(i==0&&j==0)
{
dp[i][j]=1;
continue;
}
if(i==0)
{
dp[i][j] = dp[i][j-1];
continue;
}
if(j==0)
{
dp[i][j] = dp[i-1][j];
continue;
}
dp[i][j]=dp[i][j-1]+dp[i-1][j];
}
}
return dp[n-1][m-1];
}
};
标签:Paths,题目,int,uniquePaths,62,Unique,public,105 来源: https://www.cnblogs.com/dacc123/p/11516010.html