This repository contains comprehensive, unit-tested solutions to LeetCode problems implemented in both C++20 and Python 3. Each solution includes:
- ๐งช Comprehensive test suites with multiple test cases
- ๐ Detailed documentation with complexity analysis
- ๐ง Automated code quality checks and formatting
- ๐ CI/CD pipeline with automated testing and linting
โโโ problems/ # Problem solutions organized by name
โ โโโ two_sum/ # Individual problem directories
โ โ โโโ config.yml # Problem metadata and configuration
โ โ โโโ two_sum.py # Python solution
โ โ โโโ two_sum.cc # C++ solution
โ โ โโโ two_sum.h # C++ header
โ โ โโโ two_sum_test.py # Python unit tests
โ โ โโโ two_sum_test.cc # C++ unit tests
โ โโโ ...
โโโ config/ # Global configuration files
โ โโโ difficulties.yml # Difficulty level definitions
โ โโโ tags.yml # Problem tag categories
โโโ scripts/ # Automation and utility scripts
โ โโโ generate_readme.py # Auto-generate README content
โ โโโ update_badges.py # Update repository badges
โ โโโ update_badges.sh # Badge update automation
โโโ .github/workflows/ # CI/CD automation
โ โโโ code-health-*.yml # Comprehensive testing workflows
โ โโโ linter-*.yml # Code quality workflows
โ โโโ presubmit-*.yml # Pre-merge validation
โ โโโ update-badges.yml # Automated badge updates
โโโ Makefile # Build and test automation
โโโ requirements.txt # Python dependencies
โโโ .clang-format # C++ code formatting rules
โโโ .clang-tidy # C++ linting configuration
- C++: C++20 with modern features and best practices
- Python: Python 3.x with type hints and modern syntax
- C++: Google Test (gtest) for comprehensive unit testing
- Python: pytest with coverage reporting
- C++ Formatting: clang-format for consistent code style
- C++ Linting: clang-tidy for static analysis and best practices
- Python Formatting: ruff for fast, comprehensive code formatting
- Python Linting: ruff for linting, import sorting, and code quality
- Make: Cross-platform build system with intelligent target detection
- GitHub Actions: Automated CI/CD with parallel testing and validation
The project includes comprehensive test suites for all solutions with cross-platform support.
# Run all Python tests with coverage
make test-py:all
# Run tests for a specific problem (e.g., two-sum)
make test-py:two-sum
# Run all C++ tests (auto-detects macOS/Linux)
make test-cpp:all
# Run tests for a specific problem (e.g., two-sum)
make test-cpp:two-sum
# Run all tests (both languages)
make test:all
Requirements:
- macOS:
brew install googletest
- Linux:
sudo apt-get install libgtest-dev
or build from source
This project maintains high code quality standards through automated tooling and CI/CD integration.
# Format all code (C++ with clang-format, Python with ruff)
make format
# Lint all code with comprehensive checks
make lint
# Language-specific operations
make format-cpp # Format C++ files with clang-format
make format-python # Format Python files with ruff
make lint-cpp # Lint C++ files with clang-tidy
make lint-python # Lint Python files with ruff
The project includes a comprehensive CI/CD pipeline:
-
๐ Presubmit Checks: Validate code changes before merge
- Format validation (clang-format, ruff)
- Linting checks (clang-tidy, ruff)
- Unit test execution for changed files
-
๐งช Code Health: Full validation after merge to main
- Complete test suite execution
- Cross-platform compatibility testing
- Coverage reporting
-
๐ Automated Maintenance:
- Badge updates reflecting current status
- PR size labeling for review optimization
- Workflow status monitoring
All workflows leverage the project's Makefile for consistency across local development and CI environments.
This repository covers a comprehensive range of algorithmic patterns and data structures commonly found in technical interviews:
- Arrays & Hashing
- Two Pointers
- Sliding Window
- Stack
- Binary Search
- Linked List
- Trees
- Heap / Priority Queue
- Backtracking
- Tries
- Graphs
- Advanced Graphs
- 1-D Dynamic Programming
- 2-D Dynamic Programming
- Greedy
- Intervals
- Math & Geometry
- Bit Manipulation
# | Title | Solution | Time | Space | Difficulty | Tag | Note |
---|---|---|---|---|---|---|---|
1 | Two Sum | Python, C++ | O(n) | O(n) | Easy | ||
217 | Contains Duplicate | Python, C++ | O(n) | O(n) | Easy |
# | Title | Solution | Time | Space | Difficulty | Tag | Note |
---|---|---|---|---|---|---|---|
125 | Valid Palindrome | Python, C++ | O(n) | O(1) | Easy |
# | Title | Solution | Time | Space | Difficulty | Tag | Note |
---|---|---|---|---|---|---|---|
2313 | Minimum Flips in Binary Tree to Get Result | Python, C++ | O(n) | O(1) | Hard | n is the number of nodes in the binary tree. |