class Solution {

public:

```
vector<int> getRow(int rowIndex) {
vector<int> row;
if(rowIndex<0) return row;
row.push_back(1);
if(rowIndex==0) return row;
vector<int> lastrow;
lastrow.push_back(1); //last row only with 1;
for(int i=1;i<=rowIndex;i++){
row.clear();
row.push_back(1);
if(i>1)
{
for(int j=1;j<rowIndex;j++)
{
row.push_back(lastrow[j-1]+lastrow[j]);
}
}
row.push_back(1);
lastrow=row;
}
return row;
}
```

};

showing error:

Input: 3

Output: [1,3,4,1]

Expected: [1,3,3,1]