A CLI-based algorithm visualization tool for 100 LeetCode problems (1-100) with step-by-step execution tracking and rich terminal displays.
- 100 Problems: Complete implementations of LeetCode problems 1-100
- Step-by-Step Visualization: Watch algorithms execute with detailed explanations
- Rich Terminal UI: Beautiful interface using the
richlibrary - Customizable Speed: Control visualization speed with
--interval - Comprehensive Tests: 1288 test cases with 100% pass rate
- Educational Focus: Detailed step tracking makes algorithm learning easier
git clone https://github.com/<your-username>/LeetCodeVisual.git
cd LeetCodeVisual
python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt# Run with default example values
python main.py 1
# Run with custom arguments
python main.py 1 2 7 11 15 9
# Control visualization speed
python main.py 1 --interval 0 # No delay
python main.py 1 --interval 1.0 # Fast (1s)
python main.py 1 --interval 3.0 # Slow (3s)
# Show help
python main.py --help
python main.py --help 1 # Help for specific problempython main.py 1 2 7 11 15 9 # Two Sum
python main.py 20 "()[]{}" # Valid Parentheses
python main.py 92 1 2 3 4 5 # Reverse Linked List II
python main.py 98 2 1 3 # Validate Binary Search Tree
python main.py 100 1 2 3 : 1 2 3 # Same Tree (colon separates two trees)python main.py 12 58Three-layer architecture for clean separation of concerns:
┌─────────────────────────────────────────┐
│ Dispatcher Layer (main.py) │
│ - Argument parsing & problem routing │
└──────────────┬──────────────────────────┘
│
┌──────────────▼──────────────────────────┐
│ Visualizer Layer (visualizer.py) │
│ - Rich UI presentation │
│ - Step-by-step display │
└──────────────┬──────────────────────────┘
│
┌──────────────▼──────────────────────────┐
│ Solver Layer (solver.py) │
│ - Pure algorithm logic (no UI deps) │
│ - Step data generation │
└─────────────────────────────────────────┘
Each problem lives in its own directory:
problems/
├── problem_1/
│ ├── __init__.py # Exports solver and visualizer
│ ├── solver.py # Algorithm implementation
│ └── visualizer.py # UI presentation
├── problem_2/
│ └── ...
└── problem_100/
└── ...
| Input Type | Example | Format |
|---|---|---|
| Single integer | python main.py 7 3 |
Direct value |
| Array | python main.py 1 2 7 11 15 9 |
Space-separated |
| String | python main.py 3 abcabcbb |
Direct or quoted |
| Multiple arrays | python main.py 2 2 4 3 : 5 6 4 |
Colon-separated |
| Linked list | python main.py 206 1 2 3 4 5 |
Space-separated values |
| Tree | python main.py 100 1 2 3 : 1 2 3 |
Colon-separated per tree |
pytest # Run all tests (1288)
pytest tests/test_problem_1.py # Run specific problem
pytest -v # Verbose output
pytest --tb=short -q # Quick runSee CLAUDE.md for detailed development guidelines, code style conventions, and architecture patterns.
- Create
problems/problem_N/directory - Implement
solver.pywith algorithm logic and step tracking - Implement
visualizer.pywith rich UI presentation - Create
__init__.pyto export both classes - Add routing in
main.py - Create tests in
tests/test_problem_N.py
- Python 3.9+
- rich (CLI visualization)
- pytest (testing)
Contributions are welcome! Please ensure:
- All tests pass (
pytest) - Code follows established patterns (see CLAUDE.md)
- Comprehensive test coverage for new features