Every Accepted was paid in blood, sweat, and runtime errors.
Note: This documentation and workflow are a work in progress. Expect ongoing improvements and refinements.
Scars of LeetCode is an automation-driven workflow for mastering LeetCode problems, generating high-quality spaced-repetition flashcards, and tracking your progress. It is designed for power users who want:
- Effortless problem management and documentation
- Automated, evidence-based Anki flashcard generation
- Seamless integration with Anki (including WSL support)
- A single source of truth for all your LeetCode learning
Use the new-problem.sh script to scaffold a new problem:
./new-problem.sh <problem_number> <problem_slug> <neetcode_150> # Example: ./new-problem.sh 21 merge-two-sorted-lists true- <problem_number>: The LeetCode problem number (e.g., 21)
- <problem_slug>: The LeetCode slug (e.g., merge-two-sorted-lists)
- <neetcode_150>: 'true' if part of NeetCode 150, else 'false'
This creates a folder under problems/ with:
- A ready-to-edit
README.md(with all required sections) - A starter
solution.py - Automatic update of the main tracker in
problems/README.md
Edit the generated README.md and solution.py for your problem. Follow the template for concise, memory-friendly notes. The tracker will always reflect your current progress.
Prompts in prompts/ ensure your documentation and flashcards are world-class:
autofill-problem-readme.txt: Guidance for writing the perfect problem README, focusing on intuition, approach, complexity, and key notes. Use this as a reference or with LLMs to auto-generate your README.create-update-anki-json.txt: The gold standard for generating Anki flashcards from your README and solution. Cards are designed for active recall, cloze deletions, and spaced repetition. Use this prompt with LLMs to generate acards.jsonfor each problem.
For each problem, generate a cards.json (using the above prompt and your README/solution). Place it in the problem's folder.
To merge all cards and import them into Anki:
python3 scripts/create_import_anki_flashcards.pyThis script will:
- Merge all
cards.jsonfiles into a master deck (anki/scars-of-leetcode.json) - Prevent duplicate cards
- Add the
NeetCode150tag automatically if the problem is part of NeetCode 150 - Import all cards into your Anki deck via AnkiConnect
Prerequisite: You must have the AnkiConnect add-on installed in your Anki desktop app.
For WSL users:
- Open Anki on Windows.
- Go to
Tools→Add-ons→ select AnkiConnect →Config. - Change the config to:
{ "webBindAddress": "0.0.0.0" } - Restart Anki.
This allows the Python script in WSL to connect to Anki running on Windows.
problems/— Each problem gets its own folder withREADME.md,solution.py, andcards.jsonscripts/create_import_anki_flashcards.py— Merges and imports all flashcards into Ankianki/scars-of-leetcode.json— Master deck (auto-generated)prompts/— LLM prompts for README and flashcard generationnew-problem.sh— Script to scaffold new problems and update the tracker
- Always use the provided prompts for README and flashcard generation for consistency and quality.
- Run the Python script regularly to keep your Anki deck up to date.
- Use the NeetCode 150 flag accurately for tagging and filtering.
- Review the generated tracker in
problems/README.mdfor your progress overview.
Contributions, suggestions, and improvements are welcome! Please open an issue or PR.
Happy grinding — and may your scars become your strength.