LeetCode 119. Pascal’s Triangle II
Solution1:我的答案
简单题目!!!OK!
class Solution {
public:
vector<int> getRow(int rowIndex) {
if (!rowIndex) return {1};
vector<int> res;
for (int i = 0; i <= rowIndex; i++) {
res.push_back(1);
for (int j = res.size() - 2; j >= 1; j--)
res[j] += res[j-1];
}
return res;
}
};
博客围绕LeetCode 119. Pascal’s Triangle II展开,提到了一种解题方案即作者的答案,认为该题目较为简单。
655

被折叠的 条评论
为什么被折叠?



