# leetcode：119. Pascal's Triangle II（Java）解答

Pascal’s Triangle II

Given an index k, return the kth row of the Pascal's triangle.

For example, given k = 3,
Return [1,3,3,1].

public class Solution {
public List<Integer> getRow(int rowIndex) {
if (rowIndex < 0) {
return null;
}
rowIndex++;
List<Integer> list = new ArrayList<>();
for (int row = 0; row < rowIndex; row++) {
int tmp = 1;
for (int col = 1; col <= row; col++) {
if (col < list.size()) {
int tmp2 = list.get(col);
list.set(col, tmp + list.get(col));
tmp = tmp2;
} else {
}
}
}
return list;
}
}

#### Leetcode 119 杨辉三角

2016-02-12 20:48:30

#### LeetCode(119) Pascal's Triangle II (Java)

2015-04-20 10:01:28

#### leetcode刷题，总结，记录，备忘 119

2016-01-24 21:44:24

#### 【LeetCode-119】 Pascal's Triangle II(C++)

2016-09-08 11:34:45

#### LeetCode 119：Pascal's Triangle II

2015-06-06 01:38:13

#### leetcode-119-基础题

2016-12-13 22:18:22

#### LEETCODE 119

2016-03-09 16:45:02

#### leetcode 119

2017-10-25 11:26:44

#### leetCode练习（119）

2016-11-02 21:51:02

#### 【LeetCode】119 Pascal's Triangle II

2015-12-03 13:58:21