The Problem
If you've ever grinded LeetCode, you know the pain:
- Constantly switching between browser and editor
- No way to track how long problems actually take you
- Losing your brute-force solution after optimizing
- No timer to simulate real interview pressure
I solved all of this by building leetcode-cli β a full LeetCode workflow that runs entirely in your terminal.
What It Does
π List & Solve Problems
leetcode list -d medium # Filter by difficulty
leetcode show 1 # View problem
leetcode pick 1 # Generate solution file
leetcode test 1 # Test locally
leetcode submit 1 # Submit to LeetCode
Files are auto-organized by difficulty and category:
leetcode/
βββ Easy/
β βββ Array/
β βββ 1.two-sum.java
βββ Medium/
βββ String/
βββ 3.longest-substring.java
β±οΈ Interview Timer
Practice under real pressure with difficulty-based defaults:
leetcode timer 1 # Easy: 20min, Medium: 40min, Hard: 60min
leetcode timer 1 -m 30 # Custom: 30 minutes
leetcode timer --stats # See your solve time history
The timer tracks your times so you can measure improvement over weeks.
πΈ Solution Snapshots
Save different approaches and compare them:
leetcode snapshot save 1 "brute-force"
# ... optimize your solution ...
leetcode snapshot save 1 "optimized"
leetcode snapshot diff 1 1 2 # Compare the two
leetcode snapshot restore 1 brute-force # Go back if needed
Never lose a working solution again.
π₯ Collaborative Coding
Practice with a partner using room codes:
# Person 1
leetcode collab host 1 # Creates room: ABC123
# Person 2
leetcode collab join ABC123
# Both solve, then compare
leetcode collab compare
Great for mock interviews with friends.
π Workspaces
Keep different contexts separate:
leetcode workspace create interview -w ~/lc-interview
leetcode workspace create daily -w ~/lc-daily
leetcode workspace use interview
Each workspace has its own config, timer history, and snapshots.
π Git Sync
Auto-backup solutions to GitHub:
leetcode config --repo https://github.com/you/leetcode-solutions.git
leetcode sync
Installation
npm install -g @night-slayer18/leetcode-cli
Or with Docker:
docker pull nightslayer/leetcode-cli:latest
Quick Start
leetcode login # Paste your LeetCode cookies
leetcode daily # Get today's challenge
leetcode pick 1 # Start solving
Why I Built This
I was tired of:
- Opening Chrome just to see the problem
- Not knowing if I was getting faster
- Losing my first approach after refactoring
Now my entire LeetCode workflow lives in the terminal, and I have data on my improvement.
Links
- GitHub: night-slayer18/leetcode-cli
- npm: @night-slayer18/leetcode-cli
- Docs: night-slayer18.github.io/leetcode-cli
If this helps your LeetCode grind, give it a β on GitHub!
What features would you want to see next? Let me know in the comments π

Top comments (0)