This package lets you get grokking as quickly as possible with Leetcode.
MIT License
This package lets you get grokking as quickly as possible with Leetcode. It provides a command-line tool for interracting with Leetcode to create either an Excel file or Anki flashcards for study. Currently, this tool supports taking in a list of leetcode question slugs or URLs or popular study sets (including the Blind 75, Grind 75, and Neetcode 150).
This package was created as an opinionated alternative to other existing packages (as listed at the bottom of this README).
$ pip install leetcode-study-tool
usage: leetcode-study-tool [-h]
(--url URL | --file FILE | --preset {blind_75,grind_75,grind_169,neetcode_150,neetcode_all})
[--format {anki,excel}] [--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,neetcode_150,neetcode_all}, -p {blind_75,grind_75,grind_169,neetcode_150,neetcode_all}
The preset to use to generate problem(s) for. (default: None)
--format {anki,excel}, -F {anki,excel}
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)
In the simplest case, if you want to Grok the most commonly asked questions, you should generate from a preset. For example, generating Anki cards from the Grind 75 is as simple as
$ leetcode-study-tool -p grind_75
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
$ 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.
When generating an Anki output, the resulting "cards" are saved as a .txt
file. These cards include three fields:
When generating an Excel output, the resulting questions are saved in an .xlsx
file. Each problem includes the following fields: