Skip to content

Commit 88fadfe

Browse files
add solution for 118 in js
1 parent deb9459 commit 88fadfe

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
const generate = function(numRows){
2+
let arr = [];
3+
for(let i = 0; i < numRows; i++){
4+
let row = [];
5+
row[0]=1;
6+
row[i] = 1;
7+
8+
for(let j = 1; j < row.length - 1; j++){
9+
row[j] = arr[i-1][j-1] + arr[i-1][j];
10+
}
11+
arr.push(row);
12+
}
13+
return arr;
14+
}

0 commit comments

Comments
 (0)