class Solution {
public:
int uniquePaths(int m, int n) {
vector<vector<int>> f(m,vector<int> (n,1)); //创建一个二维数组(并初始化)
for(int row = 1 ; row < m ; row ++) //从1开始是为了消除边界条件的风险
{
for(int col = 1 ; col < n ; col++)
{
f[row][col] = f[row-1][col] + f[row][col-1];
}
}
return f[m-1][n-1];
//f[i][j] = f[i-1][j] + f[i][j-1];
}
};