Skip to content

Commit afe8c1a

Browse files
committed
Create file
1 parent 9699972 commit afe8c1a

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
impl Solution {
2+
pub fn get_row(row_index: i32) -> Vec<i32> {
3+
let n = row_index as usize;
4+
if row_index == 0 {
5+
return vec![1];
6+
}
7+
let mut result = Vec::with_capacity(n + 1);
8+
result.push(1);
9+
let mut value = 1;
10+
for i in 0..n {
11+
value = value * (n - i) / (i + 1);
12+
result.push(value as i32);
13+
}
14+
result
15+
}
16+
}

0 commit comments

Comments
 (0)