Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 57d62a7

Browse files
committed
Add js solution to readme for leetcode problem: no.0118
1 parent d24c7fd commit 57d62a7

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

‎solution/0100-0199/0118.Pascal's Triangle/README.md‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,24 @@ class Solution {
7979
}
8080
```
8181

82+
### **JavaScript**
83+
84+
```js
85+
const generate = function (numRows) {
86+
let arr = [];
87+
for (let i = 0; i < numRows; i++) {
88+
let row = [];
89+
row[0] = 1;
90+
row[i] = 1;
91+
for (let j = 1; j < row.length - 1; j++) {
92+
row[j] = arr[i - 1][j - 1] + arr[i - 1][j];
93+
}
94+
arr.push(row);
95+
}
96+
return arr;
97+
};
98+
```
99+
82100
### **...**
83101

84102
```

‎solution/0100-0199/0118.Pascal's Triangle/README_EN.md‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,24 @@ class Solution {
7070
}
7171
```
7272

73+
### **JavaScript**
74+
75+
```js
76+
const generate = function (numRows) {
77+
let arr = [];
78+
for (let i = 0; i < numRows; i++) {
79+
let row = [];
80+
row[0] = 1;
81+
row[i] = 1;
82+
for (let j = 1; j < row.length - 1; j++) {
83+
row[j] = arr[i - 1][j - 1] + arr[i - 1][j];
84+
}
85+
arr.push(row);
86+
}
87+
return arr;
88+
};
89+
```
90+
7391
### **...**
7492

7593
```

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /