
class Solution {
public:
vector<int> getRow(int rowIndex) {
vector<int> row(rowIndex + 1);
row[0] = 1;
for (int i = 1; i <= rowIndex; ++i) {
for (int j = i; j > 0; --j) {
row[j] += row[j - 1];
}
}
return row;
}
};
原创
leetcode119. 杨辉三角 II
本文采用 CC BY-NC-SA 4.0 许可协议,转载请注明出处。