class Solution {
public:
vector<int> getRow(int rowIndex) {
vector<int> answer;
answer.push_back(1);
if(rowIndex==0) return answer;
int i=0;
while(rowIndex!=i){
for(int j=0;j<i+2;j++){
if(j==0||j==i+1) answer.push_back(1);
else answer.push_back(answer[j-1]+answer[j]);
}
answer.erase(answer.begin(),answer.begin()+i+1);
i++;
}
return answer;
}
};
将杨辉三角的计算方法直接写出即可。