Skip to content

Commit 4346d11

Browse files
authored
16 October 2023
1 parent 66c4ecf commit 4346d11

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

119. Pascal's Triangle II

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Runtime 0 ms
2+
Beats 100%
3+
4+
5+
Memory 39.9 MB
6+
Beats 87.21%
7+
8+
9+
class Solution {
10+
public List<Integer> getRow(int r) {
11+
List<Integer> res = new ArrayList<>();
12+
res.add(1);
13+
14+
for(int k=1;k<=r;k++)
15+
res.add((int) ((long)res.get(k-1) * (r - k + 1) / k));
16+
17+
return res;
18+
}
19+
}

0 commit comments

Comments
 (0)