Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit df59213

Browse files
committed
Update README.md
1 parent d8e878a commit df59213

File tree

5 files changed

+70
-56
lines changed

5 files changed

+70
-56
lines changed

README.md

Lines changed: 70 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,19 @@
33
> Leetcode 刷题助手
44
> Leetcode Assistant
55
6-
## Introduction
6+
## Features
77
一个GO CLI命令行工具辅助离线刷题记录。
8-
功能如下:
9-
- 显示题目信息
10-
- 按题目tag整理分类
11-
- 支持Openai辅助答题
8+
- 离线可使用
9+
- 自动创建Leetcode题目和代码模板
10+
- 按题目tag整理题目
11+
- 接入Openai辅助答题
1212

13-
![](./screenshots/all.png)
13+
### 题目分类
14+
![](./screenshots/toc.png)
15+
![](./screenshots/gpt.gif)
16+
17+
## What's Next
18+
- 接入notion api,使用notion管理做题进度
1419

1520
## Install
1621

@@ -19,18 +24,15 @@
1924
$ brew tap ppsteven/homebrew-tap
2025
$ brew install ppsteven/homebrew-tap/leetcode-tool
2126

22-
# 直接安装
23-
curl -fsSL https://bina.egoist.sh/zcong1993/leetcode-tool | sh
24-
25-
# show help
2627
$ leetcode-tool help
2728
```
2829

29-
## Config 配置
30-
31-
可以在项目根目录创建 `.leetcode.json` 配置文件.
30+
## Getting Started
31+
![](./screenshots/usage.gif)
32+
### 1. 新建配置文件 Config
33+
首先在创建一个做题目录,在目录下创建 `.leetcode.json` 配置文件.
3234

33-
```js
35+
```json
3436
{
3537
"lang": "go/py3/ts/java", // 项目全局语言, 配置后 new 命令 --lang 参数可省略, 目前支持 go ts js py3 java
3638
"env": "en/cn",
@@ -46,19 +48,53 @@ $ leetcode-tool help
4648
- api_key: openai key
4749
- model: openai model
4850

49-
## 使用说明
51+
### 2. 开始做题
5052

51-
[https://blog.cong.moe/post/2020-11-30-leetcode_tool](https://blog.cong.moe/post/2020-11-30-leetcode_tool)
53+
```bash
54+
# 1. 新建一个题目
55+
$ leetcode-tool new 1
56+
# 2. 写出题解, 和测试代码
57+
...
58+
```
5259

53-
## 支持语言
60+
下面是自动生成的题目注释,通过编辑注释信息,帮助我们分类该题的解法。
61+
```
62+
/**
63+
* @index 1
64+
* @title Two Sum
65+
* @difficulty EASY
66+
* @tags array,hash-table
67+
* @draft false
68+
* @link https://leetcode.cn/problems/two-sum/description/
69+
* @frontendId 1
70+
* @solved false
71+
*/
72+
```
73+
- index: 题目编号
74+
- title: 题目名称
75+
- difficulty: 题目难易程度
76+
- tags: 题目标签默认为Leetcode标签,同时也可以自定义标签
77+
- draft: 是否草稿,true 则不会在update的时候对该题进行分类
78+
- link: 题目链接
79+
- frontendId: 题目编号
80+
- solved: 是否解决
81+
82+
```bash
83+
# 3. 更新 toc 文件
84+
$ leetcode-tool update
85+
# 4. 提交代码
86+
```
87+
88+
## Support Language 支持语言
5489

5590
- Golang go
5691
- Typescript ts
5792
- Javascript js
5893
- Python3 py3
5994
- Java java
6095

61-
## 主要功能
96+
## Usage
97+
> [https://blog.cong.moe/post/2020-11-30-leetcode_tool](https://blog.cong.moe/post/2020-11-30-leetcode_tool)
6298
6399
### 新建题目代码
64100

@@ -103,55 +139,33 @@ leetcode-tool tags -f
103139
# 2.1 假如你还保留了部分题解, 还需要更新下题目状态
104140
leetcode-tool update
105141
```
142+
## Troublesome
106143

107-
## Workflow
108-
109-
如何刷题?
110-
144+
离线创建题目依赖 `problems.json` 文件,默认在本地无法获取该文件的时候,会从 [PPsteven/leetcode-tool/problems.json](https://raw.githubusercontent.com/PPsteven/leetcode-tool/master/problems.json) 下载。
145+
但是国内的用户可能由于网络原因无法下载,此时需要手动下载存放在吧本地目录中。
111146
```bash
112-
# 1. 新建一个题目
113-
$ leetcode-tool new 1
114-
# 2. 写出题解, 和测试代码
115-
...
116-
# 3. 更新 toc 文件
117-
$ leetcode-tool update
118-
# 4. 提交代码
119-
```
147+
$ go run cmd/main.go new 1
148+
file problems.json not exists, start downloading from https://raw.githubusercontent.com/PPsteven/leetcode-tool/master/problems.json
120149

121-
题目注释如何使用
122-
123-
下面是自动生成的题目注释,通过编辑注释信息,帮助我们分类该题的解法。
124-
```
125-
/**
126-
* @index 1
127-
* @title Two Sum
128-
* @difficulty EASY
129-
* @tags array,hash-table
130-
* @draft false
131-
* @link https://leetcode.cn/problems/two-sum/description/
132-
* @frontendId 1
133-
* @solved false
134-
*/
150+
# 手动下载存放在代码编写目录
151+
$ wget https://raw.githubusercontent.com/PPsteven/leetcode-tool/master/problems.json
135152
```
136-
- index: 题目编号
137-
- title: 题目名称
138-
- difficulty: 题目难易程度
139-
- tags: 题目标签(可以自定义标签)
140-
- draft: 是否草稿,true 则不会在update的时候对该题进行分类
141-
- link: 题目链接
142-
- frontendId: 题目编号
143-
- solved: 是否解决
144-
145153
## 为什么需要这个工具
146154

147155
1. leetcode 网页 IDE 太弱了, 我需要本地解题
148156
1. 网页题解难以沉淀, 例如一道题我希望整理多种解法
149157
1. GitHub 易于分享题解
150158
1. 根据自己需要, 组织题目做专题之类的总结
151159

152-
## 项目参考
153-
- 项目Fork自 https://github.com/zcong1993/leetcode-tool 此项目已多年不更新
154-
- Leetcode 题目爬取参考:https://github.com/bunnyxt/lcid
160+
## 鸣谢
161+
> https://github.com/zcong1993/leetcode-tool
162+
163+
此项目已多年不更新,本代码在Fork此仓库的基础上添加了如下功能:
164+
- 离线下载了 Leetcode 3400+题,保证了在Leetcode接口发生改变后依然可以运行。
165+
- 优化了部分代码逻辑
166+
- 接入了Openai辅助解题
167+
168+
Leetcode 题目爬虫使用Python实现,详见 `scripts` 文件夹,代码参考:https://github.com/bunnyxt/lcid
155169

156170
## 使用此工具的项目
157171

screenshots/all.png

-45.6 KB
Binary file not shown.

screenshots/gpt.gif

27.2 MB
Loading

screenshots/toc.png

104 KB
Loading

screenshots/usage.gif

23 MB
Loading

0 commit comments

Comments
 (0)