代码语言:javascript复制
class Solution {
public:
vector<vector<int>> generate(int numRows) {
vector<vector<int>> result(numRows);
if(numRows == 0)
return result;
for(int i = 0;i < numRows;i ){
for(int j = 0;j <= i;j ){
if(j == 0 || j == i)
result[i].push_back(1);
else
result[i].push_back(result[i-1][j] result[i-1][j-1]);
}
}
return result;
}
};