Skip to content

Commit 5e07f35

Browse files
authored
fix: better readme
1 parent b16c403 commit 5e07f35

File tree

2 files changed

+113
-34
lines changed

2 files changed

+113
-34
lines changed

README.md

Lines changed: 105 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,164 @@
1-
# 🧮 LeetCode Solutions
1+
# Unit-Tested LeetCode Solutions
22

33
<div align="center">
44

55
### 🔬 Code Health & Testing
66

7-
[![C++ Tests](https://img.shields.io/github/actions/workflow/status/mathusanm6/LeetCode/code-health-cpp.yml?branch=main&label=C%2B%2B%20Tests&logo=cplusplus&logoColor=white&style=for-the-badge)](https://github.com/mathusanm6/LeetCode/actions/workflows/code-health-cpp.yml)
8-
[![Python Tests](https://img.shields.io/github/actions/workflow/status/mathusanm6/LeetCode/code-health-python.yml?branch=main&label=Python%20Tests&logo=python&logoColor=white&style=for-the-badge)](https://github.com/mathusanm6/LeetCode/actions/workflows/code-health-python.yml)
7+
[![C++ Tests](https://img.shields.io/github/actions/workflow/status/mathusanm6/LeetCode/code-health-cpp.yml?branch=main&label=C%2B%2B%20Tests&logo=cplusplus&logoColor=white&style=for-the-badge&successColor=green&failureColor=red)](https://github.com/mathusanm6/LeetCode/actions/workflows/code-health-cpp.yml)
8+
[![Python Tests](https://img.shields.io/github/actions/workflow/status/mathusanm6/LeetCode/code-health-python.yml?branch=main&label=Python%20Tests&logo=python&logoColor=white&style=for-the-badge&successColor=green&failureColor=red)](https://github.com/mathusanm6/LeetCode/actions/workflows/code-health-python.yml)
99

1010
### 🔍 Code Quality & Linting
1111

12-
[![C++ Linter](https://img.shields.io/github/actions/workflow/status/mathusanm6/LeetCode/linter-cpp.yml?branch=main&label=C%2B%2B%20Linter&logo=cplusplus&logoColor=white&style=for-the-badge&color=blue)](https://github.com/mathusanm6/LeetCode/actions/workflows/linter-cpp.yml)
13-
[![Python Linter](https://img.shields.io/github/actions/workflow/status/mathusanm6/LeetCode/linter-python.yml?branch=main&label=Python%20Linter&logo=python&logoColor=white&style=for-the-badge&color=blue)](https://github.com/mathusanm6/LeetCode/actions/workflows/linter-python.yml)
12+
[![C++ Linter](https://img.shields.io/github/actions/workflow/status/mathusanm6/LeetCode/linter-cpp.yml?branch=main&label=C%2B%2B%20Linter&logo=cplusplus&logoColor=white&style=for-the-badge&successColor=green&failureColor=red)](https://github.com/mathusanm6/LeetCode/actions/workflows/linter-cpp.yml)
13+
[![Python Linter](https://img.shields.io/github/actions/workflow/status/mathusanm6/LeetCode/linter-python.yml?branch=main&label=Python%20Linter&logo=python&logoColor=white&style=for-the-badge&successColor=green&failureColor=red)](https://github.com/mathusanm6/LeetCode/actions/workflows/linter-python.yml)
1414

1515
### 📊 Repository Stats
1616

17-
[![Last Commit](https://img.shields.io/github/last-commit/mathusanm6/LeetCode?style=for-the-badge&logo=git&logoColor=white)](https://github.com/mathusanm6/LeetCode/commits/main)
17+
[![Last Commit](https://img.shields.io/github/last-commit/mathusanm6/LeetCode?style=for-the-badge&logo=git&logoColor=white&color=blue)](https://github.com/mathusanm6/LeetCode/commits/main)
1818
[![C++ Solutions](https://img.shields.io/badge/C%2B%2B%20Solutions-3-blue?style=for-the-badge&logo=cplusplus&logoColor=white)](https://github.com/mathusanm6/LeetCode/tree/main/problems)
19-
[![Python Solutions](https://img.shields.io/badge/Python%20Solutions-3-green?style=for-the-badge&logo=python&logoColor=white)](https://github.com/mathusanm6/LeetCode/tree/main/problems)
19+
[![Python Solutions](https://img.shields.io/badge/Python%20Solutions-3-blue?style=for-the-badge&logo=python&logoColor=white)](https://github.com/mathusanm6/LeetCode/tree/main/problems)
2020

2121
</div>
2222

2323
## Description
2424

25-
This repository contains my solutions to LeetCode problems. I will be updating this repository with my solutions as I solve more problems. I have included a test suite for each solution.
25+
This repository contains comprehensive, unit-tested solutions to LeetCode problems implemented in both **C++20** and **Python 3**. Each solution includes:
26+
27+
- 🧪 **Comprehensive test suites** with multiple test cases
28+
- 📝 **Detailed documentation** with complexity analysis
29+
- 🔧 **Automated code quality** checks and formatting
30+
- 🚀 **CI/CD pipeline** with automated testing and linting
31+
32+
## 📁 Project Structure
33+
34+
```
35+
├── problems/ # Problem solutions organized by name
36+
│ ├── two_sum/ # Individual problem directories
37+
│ │ ├── config.yml # Problem metadata and configuration
38+
│ │ ├── two_sum.py # Python solution
39+
│ │ ├── two_sum.cc # C++ solution
40+
│ │ ├── two_sum.h # C++ header
41+
│ │ ├── two_sum_test.py # Python unit tests
42+
│ │ └── two_sum_test.cc # C++ unit tests
43+
│ └── ...
44+
├── config/ # Global configuration files
45+
│ ├── difficulties.yml # Difficulty level definitions
46+
│ └── tags.yml # Problem tag categories
47+
├── scripts/ # Automation and utility scripts
48+
│ ├── generate_readme.py # Auto-generate README content
49+
│ ├── update_badges.py # Update repository badges
50+
│ └── update_badges.sh # Badge update automation
51+
├── .github/workflows/ # CI/CD automation
52+
│ ├── code-health-*.yml # Comprehensive testing workflows
53+
│ ├── linter-*.yml # Code quality workflows
54+
│ ├── presubmit-*.yml # Pre-merge validation
55+
│ └── update-badges.yml # Automated badge updates
56+
├── Makefile # Build and test automation
57+
├── requirements.txt # Python dependencies
58+
├── .clang-format # C++ code formatting rules
59+
└── .clang-tidy # C++ linting configuration
60+
```
61+
62+
## 🛠️ Technologies & Tools
63+
64+
### Languages & Standards
65+
66+
- **C++**: C++20 with modern features and best practices
67+
- **Python**: Python 3.x with type hints and modern syntax
68+
69+
### Testing Frameworks
70+
71+
- **C++**: Google Test (gtest) for comprehensive unit testing
72+
- **Python**: pytest with coverage reporting
73+
74+
### Code Quality Tools
75+
76+
- **C++ Formatting**: clang-format for consistent code style
77+
- **C++ Linting**: clang-tidy for static analysis and best practices
78+
- **Python Formatting**: ruff for fast, comprehensive code formatting
79+
- **Python Linting**: ruff for linting, import sorting, and code quality
80+
81+
### Build & Automation
82+
83+
- **Make**: Cross-platform build system with intelligent target detection
84+
- **GitHub Actions**: Automated CI/CD with parallel testing and validation
2685

2786
## Running Tests
2887

29-
### Python Tests
88+
The project includes comprehensive test suites for all solutions with cross-platform support.
3089

31-
To run the Python test suite, use the following commands in **the repository directory**:
90+
### 🐍 Python Tests
3291

3392
```bash
34-
# Run all Python tests
93+
# Run all Python tests with coverage
3594
make test-py:all
3695

3796
# Run tests for a specific problem (e.g., two-sum)
3897
make test-py:two-sum
3998
```
4099

41-
### C++ Tests
42-
43-
To run the C++ test suite, use the following commands in the repository directory:
100+
### ⚡ C++ Tests
44101

45102
```bash
46-
# Run all C++ tests
103+
# Run all C++ tests (auto-detects macOS/Linux)
47104
make test-cpp:all
48105

49106
# Run tests for a specific problem (e.g., two-sum)
50107
make test-cpp:two-sum
51108

52-
# Run both C++ and Python tests for all problems
109+
# Run all tests (both languages)
53110
make test:all
54111
```
55112

113+
**Requirements:**
114+
115+
- **macOS**: `brew install googletest`
116+
- **Linux**: `sudo apt-get install libgtest-dev` or build from source
117+
56118
## Code Quality
57119

58-
This project includes comprehensive code quality tools and automated linting:
120+
This project maintains high code quality standards through automated tooling and CI/CD integration.
59121

60-
### Linting and Formatting
122+
### 🎨 Formatting & Linting
61123

62124
```bash
63-
# Format all code (C++ and Python)
125+
# Format all code (C++ with clang-format, Python with ruff)
64126
make format
65127

66-
# Lint all code (C++ and Python)
128+
# Lint all code with comprehensive checks
67129
make lint
68130

69-
# Format/lint specific languages
131+
# Language-specific operations
70132
make format-cpp # Format C++ files with clang-format
71133
make format-python # Format Python files with ruff
72134
make lint-cpp # Lint C++ files with clang-tidy
73135
make lint-python # Lint Python files with ruff
74136
```
75137

76-
### Continuous Integration
138+
### 🔄 Continuous Integration
139+
140+
The project includes a comprehensive CI/CD pipeline:
77141

78-
- **Linters**: Automated code formatting and linting checks on every push/PR
79-
- **Presubmit**: Comprehensive testing of changed files before merge
80-
- **Postsubmit**: Full test suite execution after merge to main branch
81-
- All workflows leverage the project's Makefile for consistency
142+
- **🔍 Presubmit Checks**: Validate code changes before merge
143+
- Format validation (clang-format, ruff)
144+
- Linting checks (clang-tidy, ruff)
145+
- Unit test execution for changed files
146+
- **🧪 Code Health**: Full validation after merge to main
82147

83-
## Algorithms
148+
- Complete test suite execution
149+
- Cross-platform compatibility testing
150+
- Coverage reporting
151+
152+
- **📊 Automated Maintenance**:
153+
- Badge updates reflecting current status
154+
- PR size labeling for review optimization
155+
- Workflow status monitoring
156+
157+
All workflows leverage the project's Makefile for consistency across local development and CI environments.
158+
159+
## 🧮 Algorithms & Data Structures
160+
161+
This repository covers a comprehensive range of algorithmic patterns and data structures commonly found in technical interviews:
84162

85163
- [Arrays & Hashing](#arrays--hashing)
86164
- [Two Pointers](#two-pointers)
@@ -111,7 +189,3 @@ make lint-python # Lint Python files with ruff
111189
| # | Title | Solution | Time | Space | Difficulty | Tag | Note |
112190
|---|-------|----------|------|-------|------------|-----|------|
113191
| 125 | [Valid Palindrome](https://leetcode.com/problems/valid-palindrome/) | [Python](./problems/valid_palindrome/valid_palindrome.py), [C++](./problems/valid_palindrome/valid_palindrome.cc) | _O(n)_ | _O(1)_ | Easy | | |
114-
115-
## License
116-
117-
This project is licensed under the MIT License - see the LICENSE file for details.

scripts/generate_readme.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,11 +218,16 @@ def update_readme(self, readme_path: str = "README.md"):
218218
problems_table = self.generate_problems_table()
219219

220220
# Find the algorithms section
221-
start_marker = "## Algorithms"
221+
start_marker = "## 🧮 Algorithms & Data Structures"
222222

223223
start_idx = content.find(start_marker)
224+
224225
if start_idx == -1:
225-
print(Colors.red("✗ Could not find 'Algorithms' section in README"))
226+
print(
227+
Colors.red(
228+
"✗ Could not find '🧮 Algorithms & Data Structures' section in README"
229+
)
230+
)
226231
return
227232

228233
# Look for the end of the algorithms content
@@ -266,7 +271,7 @@ def update_readme(self, readme_path: str = "README.md"):
266271
content_after = content[end_idx:] if end_idx < len(content) else ""
267272

268273
# Replace only the algorithms section
269-
new_algorithms_section = f"## Algorithms\n\n{toc}\n\n{problems_table}"
274+
new_algorithms_section = f"## 🧮 Algorithms & Data Structures\n\nThis repository covers a comprehensive range of algorithmic patterns and data structures commonly found in technical interviews:\n\n{toc}\n\n{problems_table}"
270275

271276
new_content = content[:start_idx] + new_algorithms_section + content_after
272277

0 commit comments

Comments
 (0)