class Solution { public: /** * * @param m int整型 * @param n int整型 * @return int整型 */ int uniquePaths(int m, int n) { // dp[i][j] = dp[i-1][j]+ dp[i][j-1] vector<vector<int> > dp(m + 1, vector<int>(n + 1, 1)); for (int i = 2; i < m + 1; i++) { for (int j = 2; j < n + 1; j++) { dp[i][j] = dp[i - 1][j] + dp[i][j - 1]; } } return dp[m][n]; } };