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 1fd098d

Browse files
committed
feat(all):update template && add parser | fetcher script
1 parent d56e640 commit 1fd098d

File tree

84 files changed

+28955
-3389
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+28955
-3389
lines changed

‎CONTRIBUTING.md‎

Lines changed: 0 additions & 19 deletions
This file was deleted.

‎READMEMORE.md‎

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Read me more
2+
3+
## 初始化 & 构建方式 & 部署运维 的说明
4+
5+
### LeetCode-TS 的搭建
6+
7+
#### 获取(同步)数据
8+
9+
1. 获取(更新)所有题目列表:标题、难度、题号
10+
2. 获取 Topics 列表
11+
3. 获取题目详情:标题、题号、内容(Content\Example\Note)、Topic
12+
13+
#### 初始化
14+
15+
1. 输入题号,
16+
2. 生成 目录、index.ts、README.md、index.jest.ts 文件
17+
3. index.ts 生成 注释文档
18+
19+
#### 算法编写阶段
20+
21+
1. write logic
22+
2. Compiler to js
23+
3. js 注释加上 author | github
24+
4. Commit
25+
26+
#### 电子书制作
27+
28+
1. 根据 index.ts 的内容 生成 README.md
29+
2. 更新 根目录的 README.md
30+
3. 更新 topics.md
31+
4. 初始化 README.md
32+
5. ts 代码转译 AST,获取注释信息
33+
6. 生成 readme.md 文档
34+
7. gitbook build
35+
36+
#### 提交分支 & 发布
37+
38+
1. npm run build
39+
2. git commit & git push

‎algorithms/0001.two-sum/README.md‎

Lines changed: 0 additions & 102 deletions
This file was deleted.

‎algorithms/0001.two-sum/index.ts‎

Lines changed: 36 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,34 @@
1-
`
2-
1.Tow Sum
1+
/**
2+
# 1. Two Sum
33
44
Given an array of integers, return **indices** of the two numbers such that they add up to a specific target.
55
66
You may assume that each input would have ***exactly*** one solution, and you may not use the same element twice.
77
8-
"""
8+
## Example
9+
10+
```bash
911
Given nums = [2, 7, 11, 15], target = 9,
1012
1113
Because nums[0] + nums[1] = 2 + 7 = 9,
1214
return [0, 1].
13-
"""
14-
15-
>>> Array,Hash Table
16-
`;
17-
let twoSum: (nums: number[], target: number) => number[];
15+
```
16+
*/
17+
type Submission = (nums: number[], target: number) => number[];
1818

1919
/**
2020
* 嵌套循环遍历
2121
* 这事最偷懒的办法,快速实现后,再考虑优化方案
2222
* 使用Array.forEach在性能上会有点损耗(测试用例:61ms到59ms)
2323
* @time 2018年9月13日
2424
* @status Accepted
25-
* @runtime 120ms | 40.065%
25+
* @runtime 120 ms < 40.065%
26+
* @memory N/A
2627
*/
27-
twoSum = (nums: number[], target: number): number[] => {
28+
export const twoSum: Submission = (
29+
nums: number[],
30+
target: number
31+
): number[] => {
2832
for (let i: number = 0; i < nums.length; i++) {
2933
for (let j = i + 1; j < nums.length; j++) {
3034
if (nums[i] + nums[j] == target) {
@@ -36,11 +40,15 @@ twoSum = (nums: number[], target: number): number[] => {
3640

3741
/**
3842
* 哈希存储
39-
* @time
43+
* @time 2018年9月13日
4044
* @status Accepted
41-
* @runtime 80 ms | 59.00%
45+
* @runtime 80 ms < 59.00%
46+
* @memory N/A
4247
*/
43-
twoSum = (nums: number[], target: number): number[] => {
48+
export const twoSum1: Submission = (
49+
nums: number[],
50+
target: number
51+
): number[] => {
4452
const map: any = {};
4553
nums.forEach((i, k) => (map[i] = k));
4654
for (let i = 0; i < nums.length; i++) {
@@ -52,12 +60,16 @@ twoSum = (nums: number[], target: number): number[] => {
5260
};
5361

5462
/**
55-
* 方案二:哈希存储
56-
* @time
63+
* 哈希存储
64+
* @time 2018年9月13日
5765
* @status Accepted
58-
* @runtime 56ms | 100.00%
66+
* @runtime 56 ms < 100.00%
67+
* @memory N/A
5968
*/
60-
twoSum = (nums: number[], target: number): number[] => {
69+
export const twoSum2: Submission = (
70+
nums: number[],
71+
target: number
72+
): number[] => {
6173
const map: any = {};
6274
const length: number = nums.length;
6375
for (let i = 0; i < length; i++) {
@@ -73,11 +85,15 @@ twoSum = (nums: number[], target: number): number[] => {
7385

7486
/**
7587
* 哈希遍历
76-
* @time
88+
* @time 2018年9月13日
7789
* @status Accepted
78-
* @runtime 52ms | 100%
90+
* @runtime 52 ms < 100%
91+
* @memory N/A
7992
*/
80-
twoSum = (nums: number[], target: number): number[] => {
93+
export const twoSum3: Submission = (
94+
nums: number[],
95+
target: number
96+
): number[] => {
8197
const map: any = {};
8298
const length = nums.length;
8399
for (let i = 0; i < length; i++) {
@@ -88,5 +104,3 @@ twoSum = (nums: number[], target: number): number[] => {
88104
map[nums[i]] = i;
89105
}
90106
};
91-
92-
export default twoSum;

‎algorithms/0003.longest-substring-without-repeating-characters/README.md‎

Lines changed: 0 additions & 100 deletions
This file was deleted.

0 commit comments

Comments
(0)

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