Skip to content

Commit b08fb30

Browse files
authored
feat: add typescript solution to lc problem: No.1791.Find Center of Star Graph (#532)
1 parent 431d872 commit b08fb30

File tree

3 files changed

+31
-0
lines changed

3 files changed

+31
-0
lines changed

solution/1700-1799/1791.Find Center of Star Graph/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,18 @@ class Solution:
6565

6666
```
6767

68+
### **TypeScript**
69+
70+
```ts
71+
function findCenter(edges: number[][]): number {
72+
for (let num of edges[0]) {
73+
if (edges[1].includes(num)) {
74+
return num;
75+
}
76+
}
77+
};
78+
```
79+
6880
### **...**
6981

7082
```

solution/1700-1799/1791.Find Center of Star Graph/README_EN.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,18 @@ class Solution:
7777

7878
```
7979

80+
### **TypeScript**
81+
82+
```ts
83+
function findCenter(edges: number[][]): number {
84+
for (let num of edges[0]) {
85+
if (edges[1].includes(num)) {
86+
return num;
87+
}
88+
}
89+
};
90+
```
91+
8092
### **...**
8193

8294
```
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
function findCenter(edges: number[][]): number {
2+
for (let num of edges[0]) {
3+
if (edges[1].includes(num)) {
4+
return num;
5+
}
6+
}
7+
};

0 commit comments

Comments
 (0)