给定一个非负索引 k,其中 k ≤ 33,返回杨辉三角的第 k 行。

在杨辉三角中,每个数是它左上方和右上方的数的和。
示例:
输入: 3 输出: [1,3,3,1]
注意:
此处与杨辉三角第一题的起始下标位置不同,此题从0开始,需要注意下标越界的问题
class Solution {public List<Integer> getRow(int rowIndex) {List<List<Integer>> result = new ArrayList<>();for (int i = 0; i <= rowIndex; i++) {List<Integer> row = new ArrayList<>();for (int j = 0; j <= i; j++) {if (j == 0 || j == i){row.add(1);}else {row.add(result.get(i - 1).get(j - 1) + result.get(i - 1).get(j));}}result.add(row);}return result.get(rowIndex);}}
