This document describes the tools and processes for systematically adding AI-generated solutions to all LeetCode problems in the repository.
The repository tracks 548 LeetCode problems (as listed in README.md), but many lack AI-generated solutions:
- 76 problems have
gpt5-mini.mdfiles (AI-generated solutions) - 472 problems are missing AI-generated solutions
Some problems have only human-generated solutions (e.g., jeremymanning.md), and we want to add AI solutions for all of them.
Analyzes the repository to identify which problems are missing AI-generated solutions.
Usage:
python3 identify_missing.pyWhat it does:
- Scans README.md to find all problem numbers
- Checks for existence of
problems/*/gpt5-mini.mdfiles - Reports which problems are missing AI solutions
- Creates batch files for processing (50 problems per batch)
- Saves results to temp directory and batch files
The existing auto_solver script now supports three modes:
Mode 1: Daily problem (default)
python3 auto_solver.pyMode 2: Specific problem by ID
python3 auto_solver.py 123Mode 3: Bulk solve from file
# Set your OpenAI API key
export OPENAI_API_KEY="your-api-key-here"
# Process a batch of problems
python3 auto_solver.py --bulk /tmp/batch_001.txtWhat it does:
- Fetches problem details from LeetCode API
- Generates solutions using GPT-5-mini
- Saves solutions as
problems/{id}/gpt5-mini.md - Handles rate limiting (2 seconds between requests in bulk mode)
- Reports success/failure for each problem
Automated workflow for bulk solving problems via GitHub Actions.
Location: .github/workflows/bulk_solver.yml
How to use:
- Go to the repository's Actions tab
- Select "Bulk Solve Missing LeetCode Problems"
- Click "Run workflow"
- Configure:
- batch_size: Number of problems to solve (default: 50)
- start_index: Which problem to start from (default: 0)
- Click "Run workflow" to start
What it does:
- Automatically identifies missing AI solutions
- Processes a batch of problems using auto_solver.py
- Commits and pushes generated solutions
- Can be run multiple times with different start_index values
Example workflow runs:
- Run 1: start_index=0, batch_size=50 → solves problems 1-50
- Run 2: start_index=50, batch_size=50 → solves problems 51-100
- Run 3: start_index=100, batch_size=50 → solves problems 101-150
- etc.
-
Initial Analysis
python3 identify_missing.py
This shows you how many problems need solutions (currently 472).
-
Trigger Workflow Runs
- Go to Actions → "Bulk Solve Missing LeetCode Problems"
- Run workflow with: start_index=0, batch_size=50
- Wait for completion, then run again with: start_index=50, batch_size=50
- Repeat until all problems are processed (10 runs total for 472 problems)
-
Monitor Progress
- Check the Actions tab for workflow status
- Solutions will be automatically committed to main branch
-
Setup
# Install dependencies pip install requests openai httpx # Set API key export OPENAI_API_KEY="your-key-here"
-
Generate batch files
python3 identify_missing.py
-
Process batches
# Process first batch python3 auto_solver.py --bulk /tmp/batch_001.txt # Commit changes git add problems/*/gpt5-mini.md git commit -m "Add AI solutions for batch 1" git push # Continue with remaining batches... python3 auto_solver.py --bulk /tmp/batch_002.txt # ... and so on
All AI-generated solutions follow this format:
# [Problem {ID}: {Title}]({URL})
## Initial thoughts (stream-of-consciousness)
[Initial analysis and approach]
## Refining the problem, round 2 thoughts
[Refined approach, edge cases, complexity analysis]
## Attempted solution(s)
\`\`\`python
[Complete Python solution]
\`\`\`
- [Notes about approach and complexity]- SSL certificate verification is disabled by default to match the existing
auto_solver.pypattern (required for environments behind proxies with self-signed certificates) - To enable SSL verification in production, set the environment variable:
HTTPX_VERIFY=true - All scripts have been scanned with CodeQL and found no security vulnerabilities
- API keys are passed via environment variables and never hard-coded
- The script includes 2-second delays between requests
- This prevents overwhelming the LeetCode or OpenAI APIs
- For 472 problems, expect ~15-20 minutes per batch of 50
- Problems that fail to fetch are skipped and logged
- Failed problems are reported at the end
- You can re-run with just the failed problems
- Requires access to
leetcode.com(for problem details) - Requires access to OpenAI API (for solution generation)
- GitHub Actions environment has these by default
After running batches, you can check progress:
# Count AI solutions
find problems -name "gpt5-mini.md" | wc -l
# Re-run analysis
python3 identify_missing.py- The
auto_solver.pyscript now supports three modes:- Daily mode (default):
python3 auto_solver.py - Single problem:
python3 auto_solver.py 123 - Bulk mode:
python3 auto_solver.py --bulk file.txt
- Daily mode (default):
- This bulk solver reuses the existing auto_solver logic, avoiding code duplication
- Both daily and bulk modes use the same GPT-5-mini model and format
- Solutions are idempotent - safe to re-run if a problem already has gpt5-mini.md