Skip to content

Commit db85d79

Browse files
committed
Add Neetcode study sets as presets
1 parent c6b0e9c commit db85d79

File tree

5 files changed

+658
-24
lines changed

5 files changed

+658
-24
lines changed

README.md

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
[![PyPi](https://img.shields.io/pypi/v/leetcode-study-tool)](https://pypi.org/project/leetcode-study-tool/)
66
![contributions welcome](https://img.shields.io/badge/contributions-welcome-blue.svg?style=flat)
77

8-
This package provides a command-line tool for interracting with Leetcode to create flashcards for study,
9-
which can then be imported into Anki. Currently, this tool supports taking in a list of URLs and outputting
8+
This package lets you get grokking as quickly as possible with Leetcode. It provides a command-line tool for interracting with Leetcode to create flashcards for study,
9+
which can then be imported into Anki. Currently, this tool supports taking in a list of or popular study sets (including the [Blind 75](https://www.teamblind.com/post/New-Year-Gift---Curated-List-of-Top-75-LeetCode-Questions-to-Save-Your-Time-OaM1orEU), [Grind 75](https://www.techinterviewhandbook.org/grind75), and [Neetcode 150](https://neetcode.io/practice)) and outputting
1010
problems in a format that can be imported to Anki. These cards include three fields:
1111
1. The front of the study card, containing the question ID, Title, URL, and problem description
1212
2. The publicly available solutions (and NeetCode solution, if available)
@@ -22,15 +22,20 @@ $ pip install leetcode-study-tool
2222

2323
## Usage
2424
```shell
25-
usage: leetcode-study-tool [-h] (--url URL | --file FILE | --preset {blind_75,grind_75,grind_169}) [--format {anki}] [--csrf CSRF] [--output OUTPUT] [--language LANGUAGE]
25+
usage: leetcode-study-tool [-h]
26+
(--url URL | --file FILE | --preset {blind_75,grind_75,grind_169,neetcode_150,neetcode_all})
27+
[--format {anki}] [--csrf CSRF] [--output OUTPUT]
28+
[--language LANGUAGE]
2629

2730
Generates problems from LeetCode questions in a desired format.
2831

2932
options:
3033
-h, --help show this help message and exit
31-
--url URL, -u URL The URL(s) or slug(s) of the LeetCode question(s) to generate problem(s) for. (default: None)
32-
--file FILE, -f FILE The file containing the URL(s) or slug(s) of the LeetCode question(s) to generate problem(s) for. (default: None)
33-
--preset {blind_75,grind_75,grind_169}, -p {blind_75,grind_75,grind_169}
34+
--url URL, -u URL The URL(s) or slug(s) of the LeetCode question(s) to generate
35+
problem(s) for. (default: None)
36+
--file FILE, -f FILE The file containing the URL(s) or slug(s) of the LeetCode
37+
question(s) to generate problem(s) for. (default: None)
38+
--preset {blind_75,grind_75,grind_169,neetcode_150,neetcode_all}, -p {blind_75,grind_75,grind_169,neetcode_150,neetcode_all}
3439
The preset to use to generate problem(s) for. (default: None)
3540
--format {anki}, -F {anki}
3641
The format to save the Leetcode problem(s) in. (default: anki)
@@ -42,7 +47,11 @@ options:
4247
```
4348

4449
## Example
45-
In a directory with a file named `questions.txt`, where each line is either a Leetcode problem URL or slug (or a combination of both), we can run the command
50+
In the simplest case, if you want to [Grok](https://www.reddit.com/r/leetcode/comments/t5xqb6/how_to_use_grokking/) the most commonly asked questions, you should generate from a preset. For example, generating Anki cards from the [Grind 75](https://www.techinterviewhandbook.org/grind75) is as simple as
51+
```shell
52+
$ leetcode-study-tool -p grind_75
53+
```
54+
Perhaps, instead, you'd prefer to import questions that you've already worked on. In a directory with a file named `questions.txt`, where each line is either a Leetcode problem URL or slug (or a combination of both), we can run the command
4655
```shell
4756
$ leetcode-study-tool -f questions.txt
4857
```
@@ -58,6 +67,8 @@ which will generate the file `output.txt`. We can then open Anki to import these
5867
- [ ] Add support for exporting to an excel sheet
5968
- [X] Add support for showing neetcode solutions on the back of the card as a link
6069
- [ ] Add support for determining which fields to show on the card
70+
- [ ] Use TQDM to show card generation progress
71+
- [ ] Allow for the definition of custom formatters and outputs
6172
- [ ] Reach 90% test coverage
6273

6374
## Other Usefull Stuff

leetcode_study_tool/cli.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from .creator import ProblemsCreator
55

66

7-
def parse_args() -> argparse.Namespace:
7+
def generate_parser() -> argparse.ArgumentParser:
88
"""
99
Parse the command line arguments.
1010
@@ -81,12 +81,12 @@ def parse_args() -> argparse.Namespace:
8181
help="The language to generate problem(s) for.",
8282
)
8383

84-
return parser.parse_args()
84+
return parser
8585

8686

8787
def main():
88-
args = parse_args()
89-
creator = ProblemsCreator(args)
88+
parser = generate_parser()
89+
creator = ProblemsCreator(parser.parse_args())
9090
creator.create_problems()
9191

9292

0 commit comments

Comments
 (0)