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

Browse files
committed
feat: update README.md
1 parent 34460f8 commit 1bf3c77

File tree

3 files changed

+63
-24
lines changed

3 files changed

+63
-24
lines changed

‎.leetcode.example.json‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
{
2-
"lang": "go",
3-
"cookie": "xxx"
2+
"lang": "go/py3/ts/java",
3+
"env": "en/cn",
4+
"gpt": {
5+
"api_key": "sk-xxx",
6+
"model": "gpt-3.5-turbo"
7+
}
48
}
9+

‎README.md‎

Lines changed: 56 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,23 @@
1-
# leetcode-tool![goreleaser](https://github.com/zcong1993/leetcode-tool/workflows/goreleaser/badge.svg)
1+
# leetcode-tool
22

3-
<!--
4-
[![Go Report Card](https://goreportcard.com/badge/github.com/zcong1993/leetcode-tool)](https://goreportcard.com/report/github.com/zcong1993/leetcode-tool)
5-
-->
3+
> Leetcode 刷题助手
4+
> Leetcode Assistant
65
7-
> 一个让你更方便刷题的工具
6+
## Introduction
7+
一个GO CLI命令行工具辅助离线刷题记录。
8+
功能如下:
9+
- 显示题目信息
10+
- 按题目tag整理分类
11+
- 支持Openai辅助答题
12+
13+
![](./screenshots/all.png)
814

915
## Install
1016

1117
```bash
1218
# homebrew
13-
$ brew tap zcong1993/homebrew-tap
14-
$ brew install zcong1993/homebrew-tap/leetcode-tool
19+
$ brew tap ppsteven/homebrew-tap
20+
$ brew install ppsteven/homebrew-tap/leetcode-tool
1521

1622
# 直接安装
1723
curl -fsSL https://bina.egoist.sh/zcong1993/leetcode-tool | sh
@@ -20,16 +26,25 @@ curl -fsSL https://bina.egoist.sh/zcong1993/leetcode-tool | sh
2026
$ leetcode-tool help
2127
```
2228

23-
## 配置
29+
## Config 配置
2430

2531
可以在项目根目录创建 `.leetcode.json` 配置文件.
2632

2733
```js
2834
{
29-
"lang": "go", // 项目全局语言, 配置后 new 命令 --lang 参数可省略, 目前支持 go ts js py3 java
30-
"cookie": "xxx"
35+
"lang": "go/py3/ts/java", // 项目全局语言, 配置后 new 命令 --lang 参数可省略, 目前支持 go ts js py3 java
36+
"env": "en/cn",
37+
"gpt": {
38+
"api_key": "sk-xxx",
39+
"model": "gpt-3.5-turbo"
40+
}
3141
}
3242
```
43+
- lang: 当前支持语言 go/py3/ts/java
44+
- env: 界面语言 cn 中文站/ en 英文站
45+
- gpt: 支持gpt对题目提示,在没有思路的时候辅助解题。
46+
- api_key: openai key
47+
- model: openai model
3348

3449
## 使用说明
3550

@@ -67,7 +82,10 @@ number 为网页上显示的题目序号, 例如: `leetcode-tool new 1` 创建
6782

6883
根据已完成题目类别更新 `toc` 文件夹下的算法分类状态.
6984

70-
### 更新 leetcode 分类
85+
### ChatGPT 辅助提示解题思路
86+
`leetcode-tool gpt <number>`
87+
88+
### 更新 leetcode 分类(不建议使用)
7189

7290
`leetcode-tool tags`
7391

@@ -100,29 +118,45 @@ $ leetcode-tool update
100118
# 4. 提交代码
101119
```
102120

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+
*/
135+
```
136+
- index: 题目编号
137+
- title: 题目名称
138+
- difficulty: 题目难易程度
139+
- tags: 题目标签(可以自定义标签)
140+
- draft: 是否草稿,true 则不会在update的时候对该题进行分类
141+
- link: 题目链接
142+
- frontendId: 题目编号
143+
- solved: 是否解决
144+
103145
## 为什么需要这个工具
104146

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

110-
## 模板项目
111-
112-
- Typescript [zcong1993/leetcode-ts-template](https://github.com/zcong1993/leetcode-ts-template)
152+
## 项目参考
153+
- 项目Fork自 https://github.com/zcong1993/leetcode-tool 此项目已多年不更新
154+
- Leetcode 题目爬取参考:https://github.com/bunnyxt/lcid
113155

114156
## 使用此工具的项目
115157

116158
- [zcong1993/algo-go](https://github.com/zcong1993/algo-go)
117159

118-
## 常见问题
119-
120-
### 1. 报错 panic: runtime error: invalid memory address or nil pointer dereference
121-
122-
因为 LeetCode 网站现在某些请求会校验 cookie, 采取的修复方法是请求增加了 cookie, 但是内置 cookie 没法确保长期有效.
123-
124-
所以 `.leetcode.json` 配置文件中支持 cookie 配置, 后续请访问此链接 [https://leetcode-cn.com/api/problems/all](https://leetcode-cn.com/api/problems/all) 拿到 cookie 自行更新配置文件.
125-
126160
## License
127161

128162
MIT &copy; zcong1993

‎screenshots/all.png‎

45.6 KB
Loading[フレーム]

0 commit comments

Comments
(0)

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