【动态规划】杨辉三角2


class Solution {
public List<Integer> getRow(int rowIndex) {
List<Integer> res = new ArrayList<>(rowIndex);
res.add(1);
for(int i = 0; i < rowIndex; i++){
res.add(1);
for(int j = res.size() - 2; j > 0; j--){
res.set(j , res.get(j - 1) + res.get(j));
}
}
return res;
}
}