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