119. 杨辉三角 II - 力扣(LeetCode) (leetcode-cn.com)
class Solution {
public List<Integer> getRow(int rowIndex) {
//动态规划方程 dp[i] = dp[i]+dp[i-1]
Integer[] dp = new Integer[rowIndex+1];
Arrays.fill(dp,1);
for (int i = 2; i < dp.length; i++) {
for(int j=i-1;j>0;j--){
dp[j] = dp[j] + dp[j-1];
}
}
return Arrays.asList(dp);
}
}