Skip to content

qianbinbin/leetcode2anki

Repository files navigation

lc2anki

中文说明

lc2anki is a tool generating Anki cards for LeetCode. Questions only, no solutions.

Card template from: https://github.com/invzhi/LeetCode

Usage

1. Generate cards

$ python3 lc2anki.py -h
usage: lc2anki [OPTION]...

lc2anki is a tool generating Anki cards for LeetCode.

optional arguments:
  -h, --help            show this help message and exit
  -l LANG, --lang LANG  specify language, for example: C, C++, Java
  -o FILE, --output-file FILE
                        set output file
  -d, --debug           show debug info

question options:
  -u URL, --url URL     generate cards from link, for example: https://leetcode.com/tag/array/, https://leetcode.com/problemset/top-100-liked-questions/,
                        https://leetcode.com/list/foobar/, https://leetcode.com/problem-list/93afdecd8402495fa94c8fb4b98be8fd
  -q [QUESTION ...], --question [QUESTION ...]
                        specify question id or title slug, for example: 1, two-sum, 1-100
  -i FILE, --input-file FILE
                        specify question ids or titles from FILE split by lines

Examples

From url:

$ python3 lc2anki.py --lang Python3 --url https://leetcode.com/problem-list/93afdecd8402495fa94c8fb4b98be8fd
$ python3 lc2anki.py -l Java -u https://leetcode.com/tag/array/

From specific questions:

$ python3 lc2anki.py --question 1
$ python3 lc2anki.py -q 1 2 3
$ python3 lc2anki.py -q 1-100
$ python3 lc2anki.py -q 1 2 3-100
$ python3 lc2anki.py -q two-sum
$ python3 lc2anki.py -q "Add Two Numbers"
$ python3 lc2anki.py -q two-sum "Add Two Numbers" 3-100

From questions in file:

$ cat q.txt
two-sum
Add Two Numbers
3-100
$ python3 lc2anki.py -i q.txt

2. Add note type

Add new note type "LeetCode".

Set card template with front template, back template and styling.

Set fields:

3. Import cards

About

Generate Anki cards for LeetCode

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published