A tool for studying Leetcode with Python
Project description
Leetcode Study Tool
This package provides a command-line tool for interracting with Leetcode to create flashcards for study, which can then be imported into Anki. Currently, this tool supports taking in a list of URLs and outputting problems in a format that can be imported to Anki. These cards include three fields:
- The front of the study card, containing the question ID, Title, URL, and problem description
- The publicly available solutions (and NeetCode solution, if available)
- The tags associated with the problem (i.e., if the problem involves a hash map, arrays, etc...)
Why?
This package was created as an opinionated alternative to other existing packages (as listed at the bottom of this README).
Installation
$ pip install leetcode-study-tool
Usage
usage: leetcode-study-tool [-h] (--url URL | --file FILE | --preset {blind_75,grind_75,grind_169}) [--format {anki}] [--csrf CSRF] [--output OUTPUT] [--language LANGUAGE]
Generates problems from LeetCode questions in a desired format.
options:
-h, --help show this help message and exit
--url URL, -u URL The URL(s) or slug(s) of the LeetCode question(s) to generate problem(s) for. (default: None)
--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)
--preset {blind_75,grind_75,grind_169}, -p {blind_75,grind_75,grind_169}
The preset to use to generate problem(s) for. (default: None)
--format {anki}, -F {anki}
The format to save the Leetcode problem(s) in. (default: anki)
--csrf CSRF, -c CSRF The CSRF token to use for LeetCode authentication. (default: None)
--output OUTPUT, -o OUTPUT
The output file to write the problem(s) to. (default: output.txt)
--language LANGUAGE, -l LANGUAGE
The language to generate problem(s) for. (default: None)
Example
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
$ leetcode-study-tool -f questions.txt
which will generate the file output.txt
. We can then open Anki to import these problems as demonstrated below, ensuring to select semicolon as a field separator.
Roadmap
- Add support for fetching premium questions via authentification
- Add support for importing cards into Quizlet
- Add support for fetching questions by topic or tag
- Add support for exporting to an excel sheet
- Add support for showing neetcode solutions on the back of the card as a link
- Add support for determining which fields to show on the card
- Reach 90% test coverage
Other Usefull Stuff
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for leetcode-study-tool-1.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | bf79c158067cd55297fad91993147347f80e89c80e5a6656f88e7950d51545ee |
|
MD5 | 0ee4eaf8eaf1656b69f1a4295c3ab86f |
|
BLAKE2b-256 | 4b7ce60f6cc05e2c8a936166a2397883fa6849ed5733dd545264292a7c961d11 |
Hashes for leetcode_study_tool-1.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 53530563b6fc8331a41e8d44615764191105f77945bcc9adb08a62784d8311e0 |
|
MD5 | 18c843c2c7822438be03f0be153ffadb |
|
BLAKE2b-256 | 007972625820122294d957b0cc0b90d43c79c451f63a8fb3f71e5d10e17879b3 |