|
1 | 1 | # Leetcode practice
|
2 | 2 |
|
3 |
| -在力扣练习平台!开始你的每日一题! |
| 3 | +[中文文档](docs/README_CN.md)|**英文文档**|[日文文档](docs/README_JP.md)|[韩文文档](docs/README_KR.md) |
4 | 4 |
|
5 |
| -在编辑器中编写你的代码,简单有效的执行和计时! |
| 5 | +## Introduction |
6 | 6 |
|
7 |
| -我们的目标就是让所有人: |
8 |
| -> 只用专注于代码的实现,而非繁琐的输入输出! |
| 7 | +A brief introduction: "Start practicing your daily LeetCode questions in the editor!" |
9 | 8 |
|
10 |
| - |
| 9 | +If you want to write your solutions in the editor... |
11 | 10 |
|
12 |
| -## How to use for your self? |
| 11 | +If you want to quickly access daily questions... |
13 | 12 |
|
14 |
| -### Plan A (Recommended) |
15 |
| -The best way to use is by using the `lk/lf/lc` command in your terminal. |
| 13 | +If you want to create your own solution repository... |
16 | 14 |
|
17 |
| -### Plan B (Supported) |
18 |
| -You can also use the `fork` command on github.com to create your own repository. |
| 15 | +Then, leetcode-practice will meet all your needs! |
19 | 16 |
|
20 |
| -### Plan C (Supported) |
21 |
| -We also publish a plugin for `WebStorm` and `VS Code`. You can easily use it to create your question. |
| 17 | +## Preview |
22 | 18 |
|
23 |
| -## Preparation |
| 19 | + |
24 | 20 |
|
25 |
| -只需要一个node环境即可.([如何安装node?点我了解](https://nodejs.org/en/learn/getting-started/how-to-install-nodejs)) |
| 21 | +## How should I use it? (Three options for you to choose from) |
26 | 22 |
|
27 |
| -| 依赖包 | 版本 | |
28 |
| -|--------|-------| |
29 |
| -| nodejs | `lts` | |
| 23 | +### Option A: CLI (Recommended) |
30 | 24 |
|
31 |
| -## Installation |
| 25 | +The best and most flexible way to use it is to use our CLI in the terminal. You can create and check your solutions using three core commands: `lk`, `lf`, and `lc`. |
32 | 26 |
|
33 |
| -### Global installation for cli (for plan A) |
34 |
| -1. npm install -g leetcode-practice |
35 |
| -### Using fork to make your leetcode-practice repository (for plan B) |
| 27 | +### Option B: Fork (Supported) |
36 | 28 |
|
37 |
| -### Install plugin on your editor[WebStorm/VS code] (for plan C) |
| 29 | +You can also use GitHub's fork feature to create a copy of our project. Then, you can directly use the built-in commands within the project to create and check solutions. |
38 | 30 |
|
| 31 | +### Option C: Plugin (Supported) |
39 | 32 |
|
40 |
| -## Usage |
41 |
| -### 0. 安装依赖 |
| 33 | +You can also use our `leetcode-practice` plugin available in the plugin marketplace for interactive creation and checking of solutions. (Supported on two popular editors: `WebStorm` and `VS Code`) |
42 | 34 |
|
43 |
| -```shell |
44 |
| -yarn install # 或者任意你喜欢的包管理工具,如 |
45 |
| -pnpm install |
46 |
| -``` |
| 35 | +## Prerequisites |
47 | 36 |
|
48 |
| -### 1. 获取今天的题目 |
| 37 | +For any option, you only need a Node environment. ([Don't know how to install Node? Click here to learn more](https://nodejs.org/en/learn/getting-started/how-to-install-nodejs)) |
49 | 38 |
|
50 |
| -```shell |
51 |
| -yarn leet-create |
52 |
| -``` |
| 39 | +| Dependency | Version | |
| 40 | +|------------|---------| |
| 41 | +| Node.js | `lts` | |
53 | 42 |
|
54 |
| -会通过接口获取今日题目,并会在`src`目录下根据`题目的id`+`题目的英文翻译`创建一个目录,并将今日题目和基础示例代码填充到`index.js`中。 |
55 |
| - |
56 |
| - |
57 |
| - |
58 |
| - |
59 |
| -### 2. 检验今天的题目 |
60 |
| - |
61 |
| -```shell |
62 |
| -yarn leet-check |
63 |
| -``` |
64 |
| - |
65 |
| -此指令会根据今天的题目信息去执行对应的题目文件,输出结果。 |
66 |
| - |
67 |
| -```shell |
68 |
| -yarn leet-check |
69 |
| - |
70 |
| -[leet-check]检测题目:2744.find-maximum-number-of-string-pairs |
71 |
| -执行结果: |
72 |
| -┌─────────┬──────────┬──────────┬──────────┬────────────┬───────────┐ |
73 |
| -│ (index) │ 测试结果 │ 预期结果 │ 执行结果 │ 执行用时 │ 内存占用 │ |
74 |
| -├─────────┼──────────┼──────────┼──────────┼────────────┼───────────┤ |
75 |
| -│ 0 │ '通过' │ '2' │ '2' │ '0.2113ms' │ '1.68 KB' │ |
76 |
| -│ 1 │ '通过' │ '1' │ '1' │ '0.0195ms' │ '1.73 KB' │ |
77 |
| -│ 2 │ '通过' │ '0' │ '0' │ '0.0091ms' │ '1.80 KB' │ |
78 |
| -└─────────┴──────────┴──────────┴──────────┴────────────┴───────────┘ |
79 |
| -点击跳转到题目提交:https://leetcode.cn/problems/find-maximum-number-of-string-pairs/ |
80 |
| - |
81 |
| -Done in 0.18s. |
82 |
| - |
83 |
| -``` |
84 |
| - |
85 |
| - |
86 |
| - |
87 |
| -### 3. 创建自己想要练习的题目 |
88 |
| - |
89 |
| -```shell |
90 |
| -# 可以使用你喜欢的任意包管理工具,例如 `pnpm`/`npm` |
91 |
| -yarn leet-create -i [题目编号或者名称] |
92 |
| - |
93 |
| -# e.g. |
94 |
| -yarn leet-create -i 1314 |
95 |
| -#注意如果遇到id带空格的题目,请使用字符串包裹 |
96 |
| -# e.g. |
97 |
| -yarn leet-create -i "LCP 29" |
98 |
| -``` |
99 |
| - |
100 |
| -然后会在目录中创建一个模板js文件,目录结构为: |
101 |
| - |
102 |
| -```shell |
103 |
| --src |
104 |
| -└── 1314 |
105 |
| - └── index.js # 模板js文件 可以替换题目 |
106 |
| -``` |
107 |
| - |
108 |
| - |
109 |
| - |
110 |
| - |
111 |
| - |
112 |
| -### 4. 检验自己想要练习的结果 |
113 |
| - |
114 |
| -```shell |
115 |
| -# 可以使用你喜欢的任意包管理工具,例如 `pnpm`/`npm` |
116 |
| -yarn leet-check -i [题目编号或者名称] |
117 |
| - |
118 |
| -e.g. |
119 |
| -yarn leet-check -i 1314 |
120 |
| -``` |
121 |
| - |
122 |
| -会出现其用时以及内存占用: |
123 |
| - |
124 |
| -```shell |
125 |
| -D:\GitHub\leetcode-practice> yarn leet-check -i 1314 |
126 |
| -yarn run v1.22.19 |
127 |
| -$ node common/scripts/check.js -i 1314 |
128 |
| -[leet-check]检测题目:1314.matrix-block-sum |
129 |
| -执行结果: |
130 |
| -┌─────────┬──────────┬──────────────────────────────────────┬──────────────────────────────────────┬────────────┬───────────┐ |
131 |
| -│ (index) │ 测试结果 │ 预期结果 │ 执行结果 │ 执行用时 │ 内存占用 │ |
132 |
| -├─────────┼──────────┼──────────────────────────────────────┼──────────────────────────────────────┼────────────┼───────────┤ |
133 |
| -│ 0 │ '通过' │ '[[12,21,16],[27,45,33],[24,39,28]]' │ '[[12,21,16],[27,45,33],[24,39,28]]' │ '0.2553ms' │ '2.05 KB' │ |
134 |
| -│ 1 │ '通过' │ '[[45,45,45],[45,45,45],[45,45,45]]' │ '[[45,45,45],[45,45,45],[45,45,45]]' │ '0.0224ms' │ '2.13 KB' │ |
135 |
| -└─────────┴──────────┴──────────────────────────────────────┴──────────────────────────────────────┴────────────┴───────────┘ |
136 |
| -点击跳转到题目提交:https://leetcode.cn/problems/matrix-block-sum/ |
137 |
| - |
138 |
| -Done in 0.18s. |
139 |
| - |
140 |
| -``` |
141 |
| - |
142 |
| -当然如果你之前执行了`leet-create -i`指令创建的题目,也可以不指定号码,系统会自动读取上一个指定创建的题目进行监测。 |
143 |
| - |
144 |
| -```shell |
145 |
| -D:\GitHub\leetcode-practice> yarn leet-check -i |
146 |
| -yarn run v1.22.19 |
147 |
| -$ node common/scripts/check.js -i |
148 |
| -[leet-check]检测题目:1314.matrix-block-sum |
149 |
| -执行结果: |
150 |
| -┌─────────┬──────────┬──────────────────────────────────────┬──────────────────────────────────────┬────────────┬───────────┐ |
151 |
| -│ (index) │ 测试结果 │ 预期结果 │ 执行结果 │ 执行用时 │ 内存占用 │ |
152 |
| -├─────────┼──────────┼──────────────────────────────────────┼──────────────────────────────────────┼────────────┼───────────┤ |
153 |
| -│ 0 │ '通过' │ '[[12,21,16],[27,45,33],[24,39,28]]' │ '[[12,21,16],[27,45,33],[24,39,28]]' │ '0.2537ms' │ '2.05 KB' │ |
154 |
| -│ 1 │ '通过' │ '[[45,45,45],[45,45,45],[45,45,45]]' │ '[[45,45,45],[45,45,45],[45,45,45]]' │ '0.0231ms' │ '2.13 KB' │ |
155 |
| -└─────────┴──────────┴──────────────────────────────────────┴──────────────────────────────────────┴────────────┴───────────┘ |
156 |
| -点击跳转到题目提交:https://leetcode.cn/problems/matrix-block-sum/ |
157 |
| - |
158 |
| -Done in 0.19s. |
159 |
| - |
160 |
| -``` |
161 |
| - |
162 |
| - |
163 |
| - |
164 |
| -### 5. 获取随机题目 |
165 |
| - |
166 |
| -```shell |
167 |
| -yarn leet-create -r |
168 |
| -``` |
169 |
| - |
170 |
| -会获取一个当前src目录中未出现过的题目并创建: |
171 |
| - |
172 |
| -```shell |
173 |
| - D:\GitHub\leetcode-practice> yarn leet-create -r |
174 |
| -yarn run v1.22.19 |
175 |
| -$ node common/scripts/create.js -r |
176 |
| -[fulfillQuestion]题目[43][字符串相乘]已完成填充. |
177 |
| -Done in 1.78s. |
178 |
| -``` |
179 |
| - |
180 |
| -### 6. 检验随机题目 |
181 |
| - |
182 |
| -```shell |
183 |
| -# 可以使用你喜欢的任意包管理工具,例如 `pnpm`/`npm` |
184 |
| -yarn leet-check -r |
185 |
| -``` |
186 |
| - |
187 |
| -会检验刚刚创建出的随机题目: |
188 |
| - |
189 |
| -```shell |
190 |
| - D:\GitHub\leetcode-practice> yarn leet-check -r |
191 |
| -yarn run v1.22.19 |
192 |
| -$ node common/scripts/check.js -r |
193 |
| -[leet-check]检测当前随机题目:43.multiply-strings |
194 |
| -执行结果: |
195 |
| -┌─────────┬──────────┬───────────┬───────────┬────────────┬───────────┐ |
196 |
| -│ (index) │ 测试结果 │ 预期结果 │ 执行结果 │ 执行用时 │ 内存占用 │ |
197 |
| -├─────────┼──────────┼───────────┼───────────┼────────────┼───────────┤ |
198 |
| -│ 0 │ '通过' │ '"6"' │ '"6"' │ '0.2153ms' │ '1.76 KB' │ |
199 |
| -│ 1 │ '通过' │ '"56088"' │ '"56088"' │ '0.0232ms' │ '2.02 KB' │ |
200 |
| -└─────────┴──────────┴───────────┴───────────┴────────────┴───────────┘ |
201 |
| -点击跳转到题目提交:https://leetcode.cn/problems/multiply-strings/ |
202 |
| - |
203 |
| -Done in 0.19s. |
204 |
| - |
205 |
| -``` |
206 |
| - |
207 |
| -## Contributor |
208 |
| - |
209 |
| -[<img src="https://avatars.githubusercontent.com/u/48346853" style="border-radius:50%;" width="30" height="30" alt="EternalHeart"/>](https://github.com/wh131462) |
210 |
| -[<img src="https://avatars.githubusercontent.com/u/61453917" style="border-radius:50%;" width="30" height="30" alt="SmartTeddy"/>](https://github.com/SmallTeddy) |
211 |
| -[<img src="https://avatars.githubusercontent.com/u/35305691" style="border-radius:50%;" width="30" height="30" alt="Hedwig-Fang"/>](https://github.com/Hedwig-Fang) |
0 commit comments