Premium LeetCode practice repository with Python solutions, algorithm templates, data structure visualizations, and automated testing. Perfect for coding interview preparation, competitive programming, and mastering algorithms with Blind 75, Grind 75, and NeetCode 150 problems.
- Python 3.13+
- make, git, Graphviz, poetry
# Clone the repository
git clone https://github.com/wisarootl/leetcode-py.git
cd leetcode-py
# Install dependencies
pip install -r requirements.txt
# Generate all problems
make gen-all-problems
# Verify setup
make testEach problem follows a consistent template:
leetcode/two_sum/
βββ README.md # Problem description and examples
βββ solution.py # Your implementation with TODO placeholder
βββ tests.py # Comprehensive test cases
βββ notebook.ipynb # Interactive playground
βββ __init__.py # Package marker
- Arrays & Hashing - Two Sum, Group Anagrams, Top K Elements
- Two Pointers - Valid Palindrome, Container With Most Water
- Sliding Window - Longest Substring, Minimum Window
- Stack - Valid Parentheses, Daily Temperatures
- Binary Search - Search Rotated Array, Find Minimum
- Linked Lists - Reverse List, Merge Lists, Detect Cycle
- Trees - Invert Tree, Maximum Depth, Serialize/Deserialize
- Tries - Implement Trie, Word Search II
- Heap/Priority Queue - Merge K Lists, Find Median
- Backtracking - Combination Sum, Word Search, N-Queens
- Graphs - Clone Graph, Course Schedule, Islands
- Advanced DP - Climbing Stairs, Coin Change, LCS
- Greedy - Jump Game, Gas Station
- Intervals - Merge Intervals, Meeting Rooms
- Math & Geometry - Rotate Image, Spiral Matrix
Includes problems from Blind 75, Grind 75, NeetCode 150, and Top Interview Questions. This is an ongoing project - contributions are welcome!
Beautiful tree rendering with anytree and Graphviz
Clean arrow-based list visualization
Interactive multi-cell playground for each problem
- Template-driven development - Consistent structure for every problem
- Beautiful visualizations - TreeNode with anytree/Graphviz, ListNode with arrows
- Interactive notebooks - Multi-cell playground for each problem
- One-command testing -
make p-test PROBLEM=problem_name - Bulk regeneration -
make gen-all-problemsfrom JSON templates - Full linting - black, isort, ruff, mypy with nbqa for notebooks
- Modern Python - PEP 585/604 syntax with full type hints
# Generate all problems to start practicing
make gen-all-problems
# Run existing problems
make p-test PROBLEM=insert_interval
make p-test PROBLEM=invert_binary_tree
# Run all tests
make testPractice existing problems:
# Work on a specific problem
make p-test PROBLEM=two_sum
# Edit leetcode/two_sum/solution.py
# Run tests to verifyAdd new problems:
# Copy problem description and solution placeholder from LeetCode
# Then ask your LLM assistant:
# "Create a new LeetCode problem for Valid Anagram"
#
# Behind the scenes, the LLM will:
# 1. Create JSON template following .amazonq/rules/problem-creation.md
# 2. Run `make p-gen PROBLEM=valid_anagram`
# 3. Generate complete problem structure with tests
# 4. You just implement the solution!The LLM follows structured rules in .amazonq/rules/problem-creation.md to ensure consistent, high-quality problem generation using proven templates.
Bulk operations:
# Test all problems
make test
# Regenerate all from templates
make gen-all-problems
# Check code quality
make lint- TreeNode:
from leetcode_py.tree_node import TreeNode- Beautiful tree visualization with anytree rendering
- Jupyter notebook support with Graphviz diagrams
- Easy array β tree conversion for testing
- ListNode:
from leetcode_py.list_node import ListNode- Clean arrow visualization (
1 -> 2 -> 3) - Simple array β list conversion
- Perfect for debugging linked list problems
- Clean arrow visualization (
- New helpers: Add to
leetcode_py/
This is an ongoing project - contributions are welcome!
Perfect for interview preparation with professional-grade tooling and beautiful visualizations.