Skip to content

Commit 71ebd05

Browse files
authored
docs!: update README.md (#39)
- update README.md - add issues/PR templates
1 parent af405d8 commit 71ebd05

File tree

7 files changed

+248
-76
lines changed

7 files changed

+248
-76
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: "[BUG] "
5+
labels: bug
6+
assignees: ""
7+
---
8+
9+
**Describe the bug**
10+
A clear and concise description of what the bug is.
11+
12+
**To Reproduce**
13+
Steps to reproduce the behavior:
14+
15+
1. Run command '...'
16+
2. See error
17+
18+
**Expected behavior**
19+
A clear and concise description of what you expected to happen.
20+
21+
**Environment:**
22+
23+
- OS: [e.g. macOS, Ubuntu]
24+
- Python version: [e.g. 3.13]
25+
- Poetry version: [e.g. 1.8.0]
26+
27+
**Additional context**
28+
Add any other context about the problem here.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: "[FEATURE] "
5+
labels: enhancement
6+
assignees: ""
7+
---
8+
9+
**Is your feature request related to a problem? Please describe.**
10+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
11+
12+
**Describe the solution you'd like**
13+
A clear and concise description of what you want to happen.
14+
15+
**Describe alternatives you've considered**
16+
A clear and concise description of any alternative solutions or features you've considered.
17+
18+
**Additional context**
19+
Add any other context or screenshots about the feature request here.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
name: Problem request
3+
about: Request a new LeetCode problem to be added
4+
title: "[PROBLEM] Add LeetCode #"
5+
labels: problem-request
6+
assignees: ""
7+
---
8+
9+
**Problem(s)**
10+
Paste problem URL(s) or list name here (LeetCode, Blind 75, NeetCode 150, etc.):
11+
12+
**Why this problem?**
13+
Brief explanation of why this problem should be added (e.g. part of a study plan, important pattern, etc.)

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
## What changed?
2+
3+
Describe your changes here.
4+
5+
## Why?
6+
7+
Brief explanation of the motivation behind this change.

CONTRIBUTING.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Contributing to LeetCode Practice Repository
2+
3+
Thank you for your interest in contributing! This repository welcomes contributions from the community.
4+
5+
## Ways to Contribute
6+
7+
### 1. Add New Problems
8+
9+
Use an LLM assistant (Cursor, GitHub Copilot Chat, Amazon Q) with the rule files:
10+
11+
- Include `.amazonq/rules/problem-creation.md` in your LLM context
12+
- Ask: "Create LeetCode problem [number] ([name])"
13+
14+
### 2. Enhance Test Cases
15+
16+
- Include `.amazonq/rules/test-case-enhancement.md` in your LLM context
17+
- Ask: "Enhance test cases for [problem_name] problem"
18+
19+
### 3. Improve Helper Classes
20+
21+
- Add new data structure helpers in `leetcode_py/data_structures/`
22+
- Follow existing patterns with generic types and visualization support
23+
24+
### 4. Bug Fixes & Improvements
25+
26+
- Fix issues in existing problems
27+
- Improve documentation
28+
- Enhance CI/CD workflows
29+
30+
## Development Setup
31+
32+
```bash
33+
git clone https://github.com/wisarootl/leetcode-py.git
34+
cd leetcode-py
35+
poetry install
36+
make test
37+
```
38+
39+
## Code Standards
40+
41+
- Follow [PEP 8](https://peps.python.org/pep-0008/) Python style guide
42+
- Use modern type hints per [PEP 585](https://peps.python.org/pep-0585/)/[PEP 604](https://peps.python.org/pep-0604/): `list[str]`, `dict[str, int]`, `Type | None`
43+
- Automated linting enforced by CI (black, isort, ruff, mypy)
44+
- Minimum 12 test cases per problem
45+
46+
## Pull Request Process
47+
48+
1. Fork the repository
49+
2. Create a feature branch
50+
3. Make your changes
51+
4. Run `make lint` and `make test`
52+
5. Submit a pull request with clear description
53+
54+
## Questions?
55+
56+
Open an issue for questions or discussions about contributions.

README.md

Lines changed: 125 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,38 @@
77
[![tests](https://img.shields.io/github/actions/workflow/status/wisarootl/leetcode-py/ci-test.yml?branch=main&label=tests&logo=github)](https://github.com/wisarootl/zerv/actions/workflows/ci-test.yml)
88
[![release](https://img.shields.io/github/actions/workflow/status/wisarootl/leetcode-py/cd.yml?branch=main&label=release&logo=github)](https://github.com/wisarootl/zerv/actions/workflows/cd.yml)
99

10-
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.
10+
A modern Python LeetCode practice environment that goes beyond basic problem solving. Features automated problem generation from LeetCode URLs, beautiful data structure visualizations (TreeNode, ListNode, GraphNode), and comprehensive testing with 12+ test cases per problem. Built with professional development practices including CI/CD, type hints, and quality gates.
11+
12+
**What makes this different:**
13+
14+
- 🤖 **LLM-Assisted Workflow**: Generate new problems instantly with AI assistance
15+
- 🎨 **Visual Debugging**: Interactive tree/graph rendering with Graphviz and anytree
16+
- 🧪 **Production Testing**: Comprehensive test suites with edge cases and reproducibility verification
17+
- 🚀 **Modern Python**: PEP 585/604 type hints, Poetry, and professional tooling
18+
- 📊 **Quality Assurance**: 95%+ test coverage, security scanning, automated linting
19+
20+
Includes all **75 Grind problems** - the most essential coding interview questions curated for maximum impact.
21+
22+
## 🎯 What's Included
23+
24+
**Current**: All 75 problems from [Grind 75](https://www.techinterviewhandbook.org/grind75/) - the most essential coding interview problems curated by the creator of Blind 75.
25+
26+
**Future**: Planned expansion to all 169 Grind problems for comprehensive interview preparation.
1127

1228
## 🚀 Quick Start
1329

1430
```bash
15-
# Clone the repository
31+
# Clone and setup
1632
git clone https://github.com/wisarootl/leetcode-py.git
1733
cd leetcode-py
18-
19-
# Install dependencies
2034
poetry install
2135

22-
# Generate all problems to start practicing (fresh start - wipes all solutions)
23-
make gen-all-problems
36+
# Start with existing Grind 75 problems
37+
make gen-all-problems # Regenerates all problems with TODO placeholders
2438

25-
# Run existing problems
26-
make p-test PROBLEM=insert_interval
27-
make p-test PROBLEM=invert_binary_tree
39+
# Practice a specific problem
40+
make p-test PROBLEM=two_sum
41+
# Edit leetcode/two_sum/solution.py, then rerun tests
2842

2943
# Run all tests
3044
make test
@@ -33,113 +47,148 @@ make test
3347
## 📋 Prerequisites
3448

3549
- Python 3.13+
36-
- make, git, Graphviz, poetry
50+
- Poetry, Make, Git, Graphviz
3751

3852
## 📁 Problem Structure
3953

40-
Each problem follows a consistent template:
54+
Each problem follows a consistent, production-ready template:
4155

4256
```
4357
leetcode/two_sum/
44-
├── README.md # Problem description and examples
45-
├── solution.py # Your implementation with TODO placeholder
46-
├── tests.py # Comprehensive test cases
47-
├── notebook.ipynb # Interactive playground
48-
└── __init__.py # Package marker
58+
├── README.md # Problem description with examples and constraints
59+
├── solution.py # Implementation with type hints and TODO placeholder
60+
├── test_solution.py # Comprehensive parametrized tests (12+ test cases)
61+
├── helpers.py # Test helper functions
62+
├── playground.py # Interactive debugging environment (converted from .ipynb)
63+
└── __init__.py # Package marker
4964
```
5065

51-
## 🎯 Supported Problem Categories (ongoing)
66+
## ✨ Key Features
5267

53-
- **Arrays & Hashing** - Two Sum, Group Anagrams, Top K Elements
54-
- **Two Pointers** - Valid Palindrome, Container With Most Water
55-
- **Sliding Window** - Longest Substring, Minimum Window
56-
- **Stack** - Valid Parentheses, Daily Temperatures
57-
- **Binary Search** - Search Rotated Array, Find Minimum
58-
- **Linked Lists** - Reverse List, Merge Lists, Detect Cycle
59-
- **Trees** - Invert Tree, Maximum Depth, Serialize/Deserialize
60-
- **Tries** - Implement Trie, Word Search II
61-
- **Heap/Priority Queue** - Merge K Lists, Find Median
62-
- **Backtracking** - Combination Sum, Word Search, N-Queens
63-
- **Graphs** - Clone Graph, Course Schedule, Islands
64-
- **Advanced DP** - Climbing Stairs, Coin Change, LCS
65-
- **Greedy** - Jump Game, Gas Station
66-
- **Intervals** - Merge Intervals, Meeting Rooms
67-
- **Math & Geometry** - Rotate Image, Spiral Matrix
68+
### Production-Grade Development Environment
6869

69-
Includes problems from **Blind 75**, **Grind 75**, **NeetCode 150**, and **Top Interview Questions**.
70+
- **Modern Python**: PEP 585/604 type hints, snake_case conventions
71+
- **Comprehensive Linting**: black, isort, ruff, mypy with nbqa for notebooks
72+
- **High Test Coverage**: 12+ test cases per problem including edge cases
73+
- **Beautiful Logging**: loguru integration for enhanced test debugging
74+
- **CI/CD Pipeline**: Automated testing, security scanning, and quality gates
7075

71-
## 🎨 Visualizations
76+
### Enhanced Data Structure Visualization
7277

73-
### Tree Visualization
78+
- **TreeNode**: Beautiful tree rendering with anytree and Graphviz
79+
- **ListNode**: Clean arrow-based visualization (`1 -> 2 -> 3`)
80+
- **Interactive Debugging**: Multi-cell playground environment
7481

7582
![Tree Visualization Placeholder](docs/images/tree-viz.png)
7683
_Beautiful tree rendering with anytree and Graphviz_
7784

78-
### Linked List Visualization
79-
8085
![LinkedList Visualization Placeholder](docs/images/linkedlist-viz.png)
8186
_Clean arrow-based list visualization_
8287

83-
### Jupyter Notebook Integration
88+
### Flexible Notebook Support
89+
90+
- **Template Generation**: Creates Jupyter notebooks (`.ipynb`) by default
91+
- **Repository State**: This repo uses Python files (`.py`) for better version control
92+
- **User Choice**: Use `make nb-to-py` to convert notebooks to Python files, or keep as `.ipynb` for interactive development
8493

8594
![Notebook Placeholder](docs/images/notebook-example.png)
8695
_Interactive multi-cell playground for each problem_
8796

88-
## ✨ Features
89-
90-
- **Template-driven development** - Consistent structure for every problem
91-
- **Beautiful visualizations** - TreeNode with anytree/Graphviz, ListNode with arrows
92-
- **Interactive notebooks** - Multi-cell playground for each problem
93-
- **One-command testing** - `make p-test PROBLEM=problem_name`
94-
- **Bulk regeneration** - `make gen-all-problems` from JSON templates
95-
- **Full linting** - black, isort, ruff, mypy with nbqa for notebooks
96-
- **Modern Python** - PEP 585/604 syntax with full type hints
97+
## 🔄 Usage Patterns
9798

98-
## 🔄 Workflow Examples
99+
### For Current Grind 75 Problems
99100

100-
**Practice existing problems**:
101+
Perfect if you want to focus on the most essential interview problems:
101102

102103
```bash
103-
# Work on a specific problem
104-
make p-test PROBLEM=lru_cache
105-
# Edit leetcode/lru_cache/solution.py
106-
# Run tests to verify
104+
# Regenerate all 75 problems with fresh TODO placeholders
105+
make gen-all-problems
107106

108-
# Or use make p-test if default problem is set in Makefile
109-
make p-test
107+
# Work through problems systematically
108+
make p-test PROBLEM=two_sum
109+
make p-test PROBLEM=valid_palindrome
110+
make p-test PROBLEM=merge_two_sorted_lists
110111
```
111112

112-
**Add new problems**:
113+
### For Additional Problems (LLM-Assisted)
114+
115+
If you need more problems beyond Grind 75, use an LLM assistant in your IDE (Cursor, GitHub Copilot Chat, Amazon Q, etc.):
113116

114117
```bash
115-
# Ask your LLM assistant:
116-
# "Create LeetCode problem 146 (LRU Cache)"
117-
# The assistant handles everything automatically!
118+
# Example commands to give your LLM assistant:
119+
"Create LeetCode problem 146 (LRU Cache)"
120+
"Add problem 'Word Ladder' by number 127"
121+
"Generate problem 'Serialize and Deserialize Binary Tree'"
122+
123+
# For test enhancement (when you need more comprehensive test coverage):
124+
"Enhance test cases for two_sum problem"
125+
"Fix test reproducibility for binary_tree_inorder_traversal"
118126
```
119127

120-
_Behind the scenes: Assistant follows `.amazonq/rules/problem-creation.md` to scrape problem data, create JSON template, generate structure with `make p-gen`, and verify with `make lint`._
128+
**Required LLM Context**: Include these rule files in your LLM context for automated problem generation and test enhancement:
129+
130+
- [`.amazonq/rules/problem-creation.md`](.amazonq/rules/problem-creation.md) - Complete problem generation workflow
131+
- [`.amazonq/rules/test-case-enhancement.md`](.amazonq/rules/test-case-enhancement.md) - Test enhancement and reproducibility verification
121132

122-
**Bulk operations**:
133+
**Manual Check**: Find problems needing more test cases:
123134

124135
```bash
125-
# Test all problems
126-
make test
127-
# Regenerate all from templates
128-
make gen-all-problems
129-
# Check code quality
130-
make lint
136+
poetry run python .templates/check_test_cases.py --threshold=10
131137
```
132138

133-
## 🧰 Helper Classes (ongoing)
139+
## 🧰 Helper Classes
134140

135141
- **TreeNode**: `from leetcode_py import TreeNode`
136-
- Beautiful tree visualization with anytree rendering
137-
- Jupyter notebook support with Graphviz diagrams
138-
- Easy array ↔ tree conversion for testing
142+
- Array ↔ tree conversion: `TreeNode.from_list([1,2,3])`, `tree.to_list()`
143+
- Beautiful anytree text rendering and Graphviz SVG for Jupyter
144+
- Node search: `tree.find_node(value)`
145+
- Generic type support: `TreeNode[int]`, `TreeNode[str]`
146+
139147
- **ListNode**: `from leetcode_py import ListNode`
140-
- Clean arrow visualization (`1 -> 2 -> 3`)
141-
- Simple array ↔ list conversion
142-
- Perfect for debugging linked list problems
143-
- New helpers: Add to `leetcode_py/`
148+
- Array ↔ list conversion: `ListNode.from_list([1,2,3])`, `node.to_list()`
149+
- Cycle detection with Floyd's algorithm
150+
- Graphviz visualization for Jupyter notebooks
151+
- Generic type support: `ListNode[int]`, `ListNode[str]`
152+
153+
- **GraphNode**: `from leetcode_py import GraphNode`
154+
- Adjacency list conversion: `GraphNode.from_adjacency_list([[2,4],[1,3],[2,4],[1,3]])`
155+
- Clone detection: `original.is_clone(cloned)`
156+
- Graphviz visualization for undirected graphs
157+
- DFS traversal utilities
158+
159+
- **DictTree**: `from leetcode_py.data_structures import DictTree`
160+
- Perfect for Trie implementations: `DictTree[str]()`
161+
- Beautiful tree rendering with box-drawing characters
162+
- Graphviz visualization for Jupyter notebooks
163+
- Generic key type support
164+
165+
## 🛠️ Development Commands
166+
167+
```bash
168+
# Problem-specific operations
169+
make p-test PROBLEM=problem_name # Test specific problem
170+
make p-gen PROBLEM=problem_name # Generate problem from JSON template
171+
make p-lint PROBLEM=problem_name # Lint specific problem
172+
173+
# Bulk operations
174+
make test # Run all tests
175+
make lint # Lint entire codebase
176+
make gen-all-problems # Regenerate all problems (destructive)
177+
```
178+
179+
## 🏗️ Architecture
180+
181+
- **Template-Driven**: JSON templates in `.templates/leetcode/json/` drive code generation
182+
- **Cookiecutter Integration**: Uses `.templates/leetcode/{{cookiecutter.problem_name}}/` template for consistent file structure
183+
- **Automated Scraping**: LLM-assisted problem data extraction from LeetCode
184+
- **Version Control Friendly**: Python files by default, optional notebook support
185+
186+
## 📊 Quality Metrics
187+
188+
- **Test Coverage**: 95%+ with comprehensive edge case testing (Codecov integration)
189+
- **Security**: SonarCloud quality gates, Trivy dependency scanning, Gitleaks secret detection
190+
- **Code Quality**: Automated linting with black, isort, ruff, mypy
191+
- **Test Reproducibility**: Automated verification that problems can be regenerated consistently
192+
- **CI/CD**: GitHub Actions for testing, security, pre-commit hooks, and release automation
144193

145-
Perfect for interview preparation with professional-grade tooling and beautiful visualizations.
194+
Perfect for systematic coding interview preparation with professional development practices and enhanced debugging capabilities.

docs/images/linkedlist-viz.png

8.61 KB
Loading

0 commit comments

Comments
 (0)