119. Pascal's Triangle II
class Solution {
public:
vector<int> getRow(int rowIndex) {
vector<vector<int>> v(rowIndex+1,vector<int>());
v[0].push_back(1);
if(rowIndex==0) return v[0];
v[1].push_back(1);v[1].push_back(1);
for(int i =2;i<rowIndex+1;i++)
{
v[i].push_back(1);
for(int k = 0;k<v[i-1].size()-1;k++)
{
v[i].push_back(v[i-1][k]+v[i-1][k+1]);
}
v[i].push_back(1);
}
return v[rowIndex];
}
};