> For the complete documentation index, see [llms.txt](https://liuyang89116.gitbook.io/my-leetcode-book/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://liuyang89116.gitbook.io/my-leetcode-book/post_chapter_3_array/problem_119_pascals_triangle_ii.md).

# Problem 119: Pascal's Triangle II

> <https://leetcode.com/problems/pascals-triangle-ii/>

## 思路

* 这道题更简单了，就是上一题只需要找到 row 就可以了

```java
public class Solution {
    public List<Integer> getRow(int rowIndex) {
        List<Integer> row = new ArrayList<Integer>();
        if (rowIndex < 0) {
            return row;
        }

        for (int i = 0; i <= rowIndex; i++) {
            row.add(0, 1);
            for (int j = 1; j < row.size() - 1; j++) {
                row.set(j, row.get(j) + row.get(j + 1));
            }
        } 

        return row;
    }
}
```
