LeetSolv is a CLI tool for Data Structures and Algorithms (DSA) problem revision with spaced repetition. It's powered by a customized SuperMemo 2 algorithm that incorporates variables such as familiarity, importance, and reasoning. This approach moves beyond rote memorization, helping you to master complex algorithms through deliberate practice.
Curious how this compares to tools like Anki? See the FAQ.
0️⃣ Zero Dependencies Philosophy: Implemented entirely in pure Go with no third-party libraries, APIs, or external tools. Even some standard packages are avoided to give full control over the underlying implementations—highlighting the project’s focus on fundamentals. For more details, see MOTIVATION.md.
The LeetSolv Workflow:
This diagram illustrates the recommended daily workflow for using LeetSolv effectively.
graph LR
A{What are you working on?} --> B[A New Problem];
A --> C[A Due Problem on LeetSolv];
D[Practice the Problem] --> E[Add/Update to LeetSolv];
B --> D
C --> D
E --> F((SM-2 Algorithm Schedules Review));
- LeetSolv
Download and run the installation script
curl -fsSL https://raw.githubusercontent.com/eannchen/leetsolv/main/install.sh | bash
Future Windows automated installation support is planned.
- Go to Releases
- Download the binary for your platform:
- Linux:
leetsolv-linux-amd64
orleetsolv-linux-arm64
- macOS:
leetsolv-darwin-amd64
orleetsolv-darwin-arm64
- Windows:
leetsolv-windows-amd64.exe
orleetsolv-windows-arm64.exe
- Linux:
For detailed installation instructions, see INSTALL.md
leetsolv version
leetsolv help
When a problem is added, LeetSolv applies the SM-2 algorithm with custom factors—familiarity (5 levels), importance (4 levels), and reasoning (3 levels)— to calculate the next review date. And a randomization is applied to avoid bunching reviews into the same days. This design reinforces the goal of mastering data structures and algorithms and avoids rote recall.
graph TD
A[Add a DSA Problem to LeetSolv] --> B[Algorithm Applies Adaptations]
B --> C[Familiarity Scale]
B --> D[Importance Scale]
B --> E[Reasoning Scale]
B --> F[Due Penalty, optional]
B --> G[Randomization, optional]
H[Algorithm Calculates with SM-2 Ease Factor]
C --> H
D --> H
E --> H
F --> H
G --> H
H --> I[Determine Next Review]
Check here to learn more about the algorithm: Interval Growth Curve
With SM-2, due reviews can easily accumulate since users have varying schedules and study habits. To address this challenge, LeetSolv introduces a due priority scoring feature that allows users to prioritize due questions based on the priority score.
graph LR
A[Question] --> B[Priority Score Calculation]
B --> C[Importance Weight]
B --> D[Overdue Weight]
B --> E[Familiarity Weight]
B --> F[Review Count]
B --> G[Ease Factor]
C --> H[Final Priority Score]
D --> H
E --> H
F --> H
G --> H
H --> I[Sort by Score]
I --> J[Top-K Due Questions]
I --> K[Top-K Upcoming Questions]
By default, the priority score is calculated using the following formula: (1.5×Importance)+(0.5×Overdue Days)+(3.0×Familiarity)+(-1.5×Review Count)+(-1.0×Ease Factor)
This system helps you prioritize problems and manage your review schedule efficiently, even with limited study time.
Your review intervals are automatically set based on a problem's importance. This interval then expands over time based on your familiarity and reasoning level with the problem.
This means you can:
- Build a strong foundation: Prioritize NeetCode Blind 75 or NeetCode 150 to build a foundation, and use NeetCode 250 for extra practice.
- Target specific goals: Prioritize problems from company-specific lists for upcoming interviews.
Critical problems are reviewed more often, while less important ones get longer intervals.
The following graphs demonstrate how review intervals grow over time for different importance levels, showing the default growth pattern:
Critical Problems: Shortest intervals with frequent reviews to ensure mastery of the most important concepts.
High Importance: Moderate intervals balance frequency for important problems.
Medium Importance: Standard intervals for regular practice.
Low Importance: Longer intervals for problems that require less frequent review.
Future iterations may enable the modification of algorithm parameters directly within the configuration file.
- CRUD + Undo: Easily create, view, update, and delete your problems. You can also undo your last action.
- Trie-Based Search: Instantly find problems with blazing-fast search and filtering by keyword, importance, familiarity, and more.
- Quick Views: Get a summary of all your problems, including those that are due soon, or view a full paginated list.
graph TD
A[User Command] --> B{Command Type}
B -->|Search/List| C[Apply Filters & Search] --> D[Trie-Based Search] --> E[Paginate Results]
B -->|Add/Update| F[Schedule Review by SM-2 Algorithm] --> I[Upsert Data & Index]
B -->|Remove| G[Remove Data & Index]
B -->|Undo| H[Restore Data & Index from History]
J[Add to History]
I --> J
G --> J
Search, History, Delete, Undo functionality demo:
- No Data Collection: LeetSolv does not upload user data to the internet.
- Atomic Writes: All updates use temporary files with atomic replacement to guarantee consistency and prevent data loss.
graph LR
A[Write New Data] -->|To| B[Temporary File]
B --> C[Rename Temporary File]
C -->|Replaces| D[Original File]
- Interactive & Batch Modes: Work in a turn-based interactive mode or run direct commands for quick actions.
- Intuitive Commands: Use familiar aliases like
ls
,rm
, and get color-coded output for a clear and pleasant experience.
LeetSolv can be run interactively or by passing commands directly from your terminal.
# Start interactive mode
leetsolv
# Or run commands directly
leetsolv add https://leetcode.com/problems/two-sum
leetsolv status
# Get help
leetsolv help
View Full Usage Guide (USAGE.md)
LeetSolv can be customized using environment variables or a JSON settings file. This allows you to change file paths, algorithm parameters, and scoring weights.
For a complete list of all available options, default values, and examples, please see the detailed configuration guide:
View Full Configuration Guide (CONFIGURATION.md)
A: Anki is excellent for memorizing facts that take seconds, but for DSA, it can be counterproductive. LeetSolv's custom SM-2 algorithm spaces out the review interval and uses your input on reasoning, familiarity, and a problem's importance to create a schedule that deepens your problem-solving ability—not just check if you memorized the answer.
👉 Tip: Use Anki for memorizing facts, but use LeetSolv to schedule deep, deliberate problem-solving sessions.
A: No. LeetSolv is not a solved-problem database — it’s a spaced repetition scheduler. Only add problems you actually want to revisit. The scheduling algorithm relies on the date you add a problem to calculate reviews, so bulk-adding will create an unrealistic schedule and an overwhelming pile of due problems.
👉 Tip: If you want to review an old problem you solved months ago, just re-solve it first, then add it to LeetSolv on that day. This way the "last seen" date is accurate.
A: This is the nature of the SM-2 algorithm — if you skip days or add many problems at once, the due list can grow quickly. To make this manageable, LeetSolv introduces Due Priority Scoring, which ranks due problems by importance, familiarity, overdue days, review count, and ease factor. Instead of clearing everything at once, just focus on the highest-priority problems first. The rest can safely wait until later.
👉 Tip: Once you’ve mastered a problem and re-solved it a few times, you can safely remove it from LeetSolv. The goal isn’t to track everything forever, but to focus on problems that still need spaced practice.
- INSTALL.md: Complete installation guide with troubleshooting
- USAGE.md: Command-line usage guide
- CONFIGURATION.md: Configuration options and environment variables
- DEVELOPMENT_GUIDE.md: Development workflow, CI/CD, and contribution guide
- MOTIVATION.md: Project motivation and design notes
- ALGORITHM_ROADMAP.md: Algorithm development roadmap
- This README: Project overview and quick start
Our roadmap is guided by our goal to make LeetSolv a powerful tool for deliberate practice. Have a suggestion? Feel free to open an issue!
- Separating
familiarity
intoreasoning grade
andcoding grade
- See ALGORITHM_ROADMAP.md for details
- Make the SM-2 algorithm user-customizable
- Support installation via package managers (Homebrew, Chocolatey, apt)
- Support running as a Docker container
- Support auto-updater functionality
- Add Windows installation script
- Provide a "hint" field in the question entry
- Provide daily add limit functionality
- Provide tagging functionality
- Provide export functionality
- Add support for DSA problems from other platforms
- Implement fuzzy search functionality
This project is licensed under the terms specified in the LICENSE file.
LeetSolv - A spaced repetition CLI for DSA, powered by a custom SM-2 algorithm for deliberate practice.