Skip to content

Commit e221a03

Browse files
authored
Create Solution.js
1 parent 6d9e162 commit e221a03

File tree

1 file changed

+14
-0
lines changed
  • solution/0100-0199/0119.Pascal's Triangle II

1 file changed

+14
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/**
2+
* @param {number} rowIndex
3+
* @return {number[]}
4+
*/
5+
var getRow = function(rowIndex) {
6+
const f = Array(rowIndex + 1).fill(1);
7+
for (let i = 2; i < rowIndex + 1; ++i) {
8+
for (let j = i - 1; j > 0; --j) {
9+
f[j] += f[j - 1];
10+
}
11+
}
12+
return f;
13+
14+
};

0 commit comments

Comments
 (0)