A dual-language LeetCode solutions repository with comprehensive test coverage in both Rust and Python. I start by solving each challenge by hand to practice my programming craft, then work with an AI Agent to improve and maintain the repo. This lets me also practice modern agentic collaboration.
- Framework: cargo-leet template structure with comprehensive testing
- Testing: Uses
rstestfor parameterized testing with multiple test cases - Version: Rust 1.79 (pinned to match LeetCode environment)
- Pattern: Each problem implemented as a module with local
Solutionstruct
- Framework: pytest with individual test files
- Pattern: Each file follows
test_<problem_number>.pyformat - Testing: Includes complete problem implementations with test cases
| Problem | Rust | Python | Difficulty | Time | Space | Optimal |
|---|---|---|---|---|---|---|
| 6. Zigzag Conversion | ❌ | ✅ | Medium | O(n) | O(n) | ✅ |
| 15. 3Sum | ❌ | ✅ | Medium | O(n²) | O(1) | ✅ |
| 17. Letter Combinations of a Phone Number | ❌ | ✅ | Medium | O(4ⁿ) | O(4ⁿ) | ✅ |
| 20. Valid Parentheses | ✅ | ❌ | Easy | O(n) | O(n) | ✅ |
| 21. Merge Two Sorted Lists | ❌ | ✅ | Easy | O(m+n) | O(1) | ✅ |
| 22. Generate Parentheses | ❌ | ✅ | Medium | O(4ⁿ/√n) | O(4ⁿ/√n) | ✅ |
| 24. Swap Nodes in Pairs | ❌ | ✅ | Medium | O(n) | O(1) | ✅ |
| 26. Remove Duplicates from Sorted Array | ✅ | ❌ | Easy | O(n) | O(1) | ✅ |
| 46. Permutations | ✅ | ❌ | Medium | O(n!×n) | O(n!×n) | ✅ |
| 48. Rotate Image | ❌ | ✅ | Medium | O(n²) | O(1) | ✅ |
| 50. Pow(x, n) | ✅ | ❌ | Medium | O(log n) | O(1) | ✅ |
| 71. Simplify Path | ✅ | ❌ | Medium | O(n) | O(n) | ✅ |
| 238. Product of Array Except Self | ❌ | ✅ | Medium | O(n) | O(1) | ✅ |
| 334. Increasing Triplet Subsequence | ❌ | ✅ | Medium | O(n) | O(1) | ✅ |
| 345. Reverse Vowels of a String | ❌ | ✅ | Medium | O(n) | O(n) | ✅ |
| 1071. Greatest Common Divisor of Strings | ❌ | ✅ | Easy | O(m+n) | O(1) | ✅ |
# Run script from root
./test.shcd rust
cargo test # All tests
cargo test <module_name> # Specific module (e.g., cargo test permutations)
cargo check # Quick compile check
cargo clippy # Lintercd python
pytest # All tests
pytest <test_file.py> # Specific test file
pytest -v # Verbose output- Each module contains LeetCode submission code plus local testing infrastructure
- Code above the
// << ---- Code below here is only for local use ---- >>comment is the actual LeetCode submission - Uses
rstestfor comprehensive parameterized testing - Follows cargo-leet template conventions
- Each test file contains both
Solutionclass and test functions - Includes custom data structures when needed (e.g.,
ListNodefor linked lists) - Test functions follow pattern
test_<description>()
This repository uses:
- Rust 1.79 (pinned via rust-toolchain.toml)
- pytest for Python testing
- GitHub Actions for CI/CD
- pre-commit hooks for automatic code formatting
- Comprehensive test coverage with edge cases and boundary testing
-
Install uv (if not already installed):
# Windows powershell -c "irm https://astral.sh/uv/install.ps1 | iex" # macOS/Linux curl -LsSf https://astral.sh/uv/install.sh | sh
-
Create virtual environment and install dependencies:
uv venv uv pip install pytest flake8 black isort pre-commit
-
Activate the virtual environment:
# Windows .venv\Scripts\activate # macOS/Linux source .venv/bin/activate
-
Install pre-commit hooks:
pre-commit install
-
(Optional) Run hooks on all files:
pre-commit run --all-files
Now formatting checks will run automatically before each commit!
When adding new solutions:
- Follow existing patterns for file structure and naming
- Include comprehensive test cases covering edge cases
- Add problem entry to this README table
- Run tests to ensure everything passes