class Solution {
public:
vector<int> getRow(int rowIndex) {
vector<int> res(rowIndex + 1);
res[0] = 1;
for (int i = 1; i <= rowIndex; ++i) {
for (int j = i; j >= 1; --j) {
res[j] += res[j - 1];
}
}
return res;
}
};
119.Pascal's Triangle II
猜你喜欢
转载自www.cnblogs.com/smallredness/p/10677130.html
今日推荐
周排行