class Solution {
public:
vector<vector<int>> generate(int numRows) {
if (numRows == 0) {
return {};
}
vector<vector<int>> res;
res.push_back({1});
for (int i = 0; i < numRows - 1; i++) {
int size = res[i].size();
vector<int> record;
record.push_back(res[i][0]);
for (int j = 1; j < size; j++) {
record.push_back(res[i][j - 1] + res[i][j]);
}
record.push_back(res[i][size - 1]);
res.push_back(record);
}
return res;
}
};