Leetcode 119. Pascal's Triangle II
文章作者:Tyan
博客:noahsnail.com | CSDN | 简书
1. Description
2. Solution
class Solution {
public:
vector<int> getRow(int rowIndex) {
vector<int> result(rowIndex + 1, 1);
for(int i = 0; i < rowIndex + 1; i++) {
for(int j = i - 1; j > 0; j--) {
result[j] += result[j - 1];
}
}
return result;
}
};