Skip to content

Commit 1fe241a

Browse files
119. Pascal's Triangle II (java)
1 parent 6e3400a commit 1fe241a

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
class Solution {
2+
public List<Integer> getRow(int rowIndex) {
3+
List<Integer> ret = new LinkedList<>();
4+
long nk = 1;
5+
for (int i = 0; i <= rowIndex; i++) {
6+
ret.add((int) nk);
7+
nk = nk * (rowIndex - i) / (i + 1);
8+
}
9+
return ret;
10+
}
11+
}

0 commit comments

Comments
 (0)