标签:int tor 多少 etc public blog 矩阵 需要 class
//给定m*n的矩阵,从左上角走到左下角需要多少步?
class Solution { public: int uniquePaths(int m, int n) { vector<vector<int> > table(m, vector<int>(n, 1)); for (int i = 1; i < m; i++) { for (int j = 1; j < n; j++) { table[i][j] = table[i-1][j] + table[i][j-1]; } } return table[m-1][n-1]; } };
标签:int tor 多少 etc public blog 矩阵 需要 class
原文地址:http://www.cnblogs.com/xiuxiu55/p/6513831.html