Here is my solution

For example , If the given *rowIndex* is 3;

Firstly , I add 1 to the *res* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 0th floor

Secondly , Starts form *i*=1(means floor 1) , I build the *floor i* according to the records of res(res contains previous floor's record). Then I remove all records belongs to *floor i-1*

Finally , I get *floor rowIndex*, and return it.

```
public class Solution {
public List<Integer> getRow(int rowIndex) {
List<Integer> res=new ArrayList<Integer>();
res.add(1);
for(int i=1;i<=rowIndex;i++)
{
for(int j=0;j<=i;j++)
{
if(j==0 || j==i) res.add(1);
else
{
int l=res.get(j-1);
int r=res.get(j);
res.add(l+r);
}
}
for(int j=0;j<=i-1;j++)
{
res.remove(0);
}
}
return res;
}
}
```