119. Pascal's Triangle II
和前面119. Pascal's Triangle非常相似,不赘述,下面是代码
class Solution {
public List<Integer> getRow(int row) {
List<Integer> yanghui=new ArrayList<Integer>();
for (int i=0;i<=row;i++) {
yanghui.add(0,1);
for (int j=1;j<i;j++) {
yanghui.set(j, yanghui.get(j)+yanghui.get(j+1));
}
}
return yanghui;
}
}