Skip to content

Commit 302e558

Browse files
author
于金洋
committed
Merge branch 'master' of github.com:man-fish/typescript-algorithms
2 parents 5642d57 + b5cbea4 commit 302e558

File tree

5 files changed

+19
-12
lines changed

5 files changed

+19
-12
lines changed

.prettierrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"tabWidth": 4,
3+
"useTabs": false,
4+
"singleQuote": true
5+
}

src/data-structures/queue/README.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
# Queue
22

3-
_Read this in other languages:_
4-
[_简体中文_](README.zh-CN.md),
5-
[_Русский_](README.ru-RU.md),
6-
[_日本語_](README.ja-JP.md),
7-
[_Português_](README.pt-BR.md)
8-
93
In computer science, a **queue** is a particular kind of abstract data
104
type or collection in which the entities in the collection are
115
kept in order and the principle (or only) operations on the

src/data-structures/stack/README.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
# Stack
22

3-
_Read this in other languages:_
4-
[_简体中文_](README.zh-CN.md),
5-
[_Русский_](README.ru-RU.md),
6-
[_日本語_](README.ja-JP.md),
7-
[_Português_](README.pt-BR.md)
8-
93
In computer science, a **stack** is an abstract data type that serves
104
as a collection of elements, with two principal operations:
115

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
export default function findRepeatNumber(nums: number[]): number {
2+
const s = new Set();
3+
for (let num of nums) {
4+
if (s.has(num)) {
5+
return num
6+
}
7+
s.add(num)
8+
}
9+
return -1
10+
};
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export default function replaceSpace(s: string): string {
2+
return s.split(" ").join("%20")
3+
};
4+

0 commit comments

Comments
 (0)