标签:col ++ rate row == generate add solution style
class Solution { public: vector<vector<int>> generate(int numRows) { vector<vector<int>> res; if(numRows == 0) return res; vector<int> add; add.push_back(1); res.push_back(add); if(numRows == 1) return res; for(int i=1;i < numRows;i++){ add.clear(); add.push_back(1); for(int j=1;j < i;j++){ add.push_back(res[i-1][j-1]+res[i-1][j]); } add.push_back(1); res.push_back(add); } return res; } };
_
标签:col ++ rate row == generate add solution style
原文地址:https://www.cnblogs.com/cunyusup/p/10350661.html