Leetcode Solver Bot is a fully local automated LeetCode solver that solves and submits 1,465+ LeetCode problems automatically — no API key needed. It reads solutions from a local archive, injects them into LeetCode's Monaco editor via Puppeteer browser automation, and submits — all from a tui. Useful for boosting your LeetCode profile stats and problem-solved count.
"I came, I saw, I copied the optimal solution." ~ Julius Caesar, probably
| Feature | Detail |
|---|---|
| 1,465+ C++ solutions | Local JSON archive — no network call for the solution itself |
| Cloudflare bypass | Headed Chrome with persistent session; manual login once, then it's remembered |
| Monaco API injection | Writes directly into LeetCode's editor API with retry + post-injection verification |
| Ink TUI | React-based terminal UI with live progress, verdicts, and a summary screen |
| Smart rate limiting | 8s between submissions, 15s cooldown every 5 problems — time estimate shown upfront |
| Verdict detection | Polls "Judging…" state transitions to capture the actual result reliably |
| Skip logic | Auto-skips already-solved and premium problems via GraphQL status check |
| Docker support | Self-contained container with Chromium |
- Email setup — TUI asks for your LeetCode email (saved for future runs)
- Cloudflare login — First run opens headed Chrome; complete challenge manually
- Problem selection — GraphQL checks solved/premium status. Reads solution from
data/problems/locally. - Browser setup — Puppeteer with a persistent Chrome profile. Sessions survive restarts.
- Navigation — Loads the problem URL, waits on
domcontentloaded(notnetworkidle2— avoids Cloudflare hangs). - Injection — Switches editor language to C++ if needed. Injects via Monaco API and verifies with
value.includes('class Solution') && value.length > 50. - Submission — Clicks submit, waits for
Judging…to appear then disappear, reads result. - Rate limiting — 8s delay between each problem. 15s cooldown every 5th. Time estimate printed before the run starts.
No Node.js or Chrome needed on your host. The image ships with Chrome for Testing, all dependencies, and the problem archive — everything works out of the box.
1. Pull the image
docker pull prakhxr/leetcode-solver-bot2. Run
docker run -it \
-v $(pwd)/UserData:/app/UserData \
--network host \
prakhxr/leetcode-solver-botA Chrome window opens. Enter your LeetCode credentials and complete any Cloudflare challenge. After login, close the bot — your session is saved to ./UserData/ and reused from here on.
Or use docker compose (from a cloned repo):
docker compose run leetcodeRequires Node.js 18+ and a local Chrome for Testing download.
1. Clone & install
git clone https://github.com/prakhxr0/Leetcoder.git
cd Leetcoder
npm install2. Download Chrome for Testing
The bot uses a project-local Chrome binary so it doesn't interfere with your system browser.
Linux (x64):
mkdir -p .chromium && cd .chromium
curl -sL "https://storage.googleapis.com/chrome-for-testing-public/121.0.6167.85/linux64/chrome-linux64.zip" -o chrome.zip
unzip -q chrome.zip && rm chrome.zip
chmod +x chrome-linux64/chrome
cd ..macOS (Apple Silicon):
mkdir -p .chromium && cd .chromium
curl -sL "https://storage.googleapis.com/chrome-for-testing-public/121.0.6167.85/mac-arm64/chrome-mac-arm64.zip" -o chrome.zip
unzip -q chrome.zip && rm chrome.zip
cd ..macOS (Intel):
mkdir -p .chromium && cd .chromium
curl -sL "https://storage.googleapis.com/chrome-for-testing-public/121.0.6167.85/mac-x64/chrome-mac-x64.zip" -o chrome.zip
unzip -q chrome.zip && rm chrome.zip
cd ..Windows (PowerShell):
New-Item -ItemType Directory -Force -Path .chromium
cd .chromium
Invoke-WebRequest -Uri "https://storage.googleapis.com/chrome-for-testing-public/121.0.6167.85/win64/chrome-win64.zip" -OutFile chrome.zip
Expand-Archive chrome.zip -DestinationPath .
Remove-Item chrome.zip
cd ..3. Configure .env
Create a .env file in the project root:
USER_EMAIL=your-email@example.com
GOOGLE_CHROME_EXECUTABLE_PATH=/full/path/to/Leetcoder/.chromium/chrome-linux64/chromeLinux:
/home/you/projects/Leetcoder/.chromium/chrome-linux64/chromemacOS:
.chromium/chrome-mac-arm64/Google Chrome for Testing.app/Contents/MacOS/Google Chrome for TestingWindows:
.chromium\chrome-win64\chrome.exe
4. First run (login)
npm startA Chrome window opens. Enter your LeetCode credentials and complete any Cloudflare challenge. After login, close the bot — your session is saved in ./UserData/ and reused from here on.
| Platform | Notes |
|---|---|
| Linux | Works out of the box with X11 |
| macOS | Install XQuartz: brew install --cask xquartz, then logout/login |
| WSL2 | WSLg is built-in on Windows 11, works automatically |
| Windows | Use PowerShell or Git Bash |
| Parameter | Value | Notes |
|---|---|---|
| Submission delay | 8s |
Between every problem |
| Cooldown period | 15s |
Triggered every 5 problems |
| Time estimate | count × 10s + ⌊count/5⌋ × 15s |
Shown before the run starts |
Drop new solutions into data/problems/ as JSON files following the existing format. The SolvedProblems.json tracker is updated automatically after each successful submission.
Frontend (TUI)
- React — Component model for terminal UI
- Ink — Renders React components into the terminal
- TypeScript — Type safety across TUI components
- tsx — JSX transpilation without a build step
Backend (Solver)
- Puppeteer — Browser automation + Monaco API access
- Node.js — Runtime for the entire bot
- GraphQL — LeetCode's own API for problem status checks
Data
- JSON files — 1,465 C++ solution files in
data/problems/ - SolvedProblems.json — Local tracker to avoid re-submission
Deployment
- Docker — Self-contained container with Chromium
- Docker Compose — Easy setup and configuration
- Volumes — Persistent Chrome profile and solved problems
- Cloudflare — Requires a one-time manual login. After that, the session is remembered.
- Rate delays — Fixed cooldowns; may need tuning for different network conditions.
- Premium problems — Detected via GraphQL and skipped automatically. Can't solve what you can't see.
- Session expiry — Long breaks may require re-authentication.
- Docker image size — ~500MB-1GB due to bundled Chromium and problem archive.
- Add new C++ solutions to
data/problems/ - Follow the existing JSON format
- Open a PR with what you added
MIT License · built with Puppeteer, Ink, and zero remorse
If this saved your grind, leave a ⭐


