Skip to content

TheToriqul/leetcode-solutions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

316 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ† LeetCode Solutions Archive

GitHub Workflow Status Last Sync License Python LeetCode GitHub followers

An enterprise-grade automation system that synchronizes, organizes, and documents your LeetCode solutions with comprehensive analytics and documentation.

Features β€’ Setup β€’ Usage β€’ Documentation β€’ Contributing β€’ Contact

πŸ“‹ Table of Contents

πŸš€ Key Features

  • Automated Synchronization: Daily automatic sync of your LeetCode solutions (my workflow will run at midnight (00:00) on the first day of every month. Modify for your own schedule)
  • Smart Organization: Solutions categorized by difficulty and topics
  • Comprehensive Documentation: Detailed README for each problem
  • Multi-language Support: Handles solutions in various programming languages
  • Performance Tracking: Runtime and memory usage statistics
  • Version Control: Complete history of solution improvements
  • GitHub Actions Integration: Automated workflow with manual trigger option
  • Analytics Dashboard: Track your progress and improvements
  • Custom Tagging: Organize solutions by patterns and techniques

πŸ—οΈ System Architecture

graph TD
    A[LeetCode API] -->|Fetch Solutions| B[Sync Service]
    B -->|Process & Format| C[GitHub API]
    C -->|Create/Update| D[Repository]
    E[GitHub Actions] -->|Trigger| B
    F[Manual Trigger] -->|Activate| E
    D -->|Generate| G[Documentation]
    D -->|Update| H[Analytics]
Loading

πŸ“ Project Structure

leetcode-solutions/
β”œβ”€β”€ πŸ“‚ easy/
β”‚   └── ####-problem-name/
β”‚       β”œβ”€β”€ README.md          # Problem description & stats
β”‚       β”œβ”€β”€ solution.{ext}     # Solution implementation
β”‚       └── test_cases.json    # Test cases and examples
β”œβ”€β”€ πŸ“‚ medium/
β”œβ”€β”€ πŸ“‚ hard/
β”œβ”€β”€ πŸ“‚ .github/
β”‚   └── workflows/
β”‚       └── sync.yml          # GitHub Actions workflow
β”œβ”€β”€ πŸ“‚ scripts/
β”‚   β”œβ”€β”€ sync_leetcode.py      # Main sync script
β”‚   └── utils/                # Helper utilities
β”œβ”€β”€ πŸ“œ README.md              # Main documentation
└── πŸ“Š stats/                 # Performance analytics

βš™οΈ Setup Guide

Prerequisites

  • GitHub Account with repository access
  • LeetCode Account
  • Python 3.10 or higher
  • Git CLI

Detailed Configuration Steps

  1. Repository Setup

    # Clone the repository
    git clone https://github.com/thetoriqul/leetcode-solutions.git
    cd leetcode-solutions
    
    # Install dependencies
    pip install -r requirements.txt
  2. Environment Configuration

    # Create .env file
    cp .env.example .env
    
    # Add your configuration
    GH_PAT=your_github_token
    LEETCODE_SESSION=your_leetcode_session (Remeber, you have to regularly monitor the credentials)
    GITHUB_REPO=thetoriqul/leetcode-solutions
  3. GitHub Secret Configuration

    Navigate to: Settings > Secrets and Variables > Actions

    Required Secrets:

    GH_PAT: your_github_personal_access_token
    LEETCODE_SESSION: your_leetcode_session_cookie (Remeber, you have to regularly monitor the credentials)
  4. GitHub Personal Access Token Setup

    • Visit: Settings > Developer settings > Personal access tokens > Tokens (classic)
    • Required Scopes:
      - repo (Full control of private repositories)
      - workflow (Update GitHub Action workflows)
      - admin:org (Optional: For organization-level access)
      
  5. LeetCode Session Token Retrieval

    // Browser DevTools (F12) -> Console
    document.cookie.split(';').find(cookie => 
      cookie.includes('LEETCODE_SESSION')
    ).split('=')[1]

🎯 Usage

Automatic Synchronization

Solutions are automatically synchronized at midnight (00:00) on the first day of every month.

Manual Synchronization

  1. Visit the Actions tab
  2. Select "Sync LeetCode Solutions"
  3. Click "Run workflow"
  4. Select branch (default: main)
  5. Trigger the workflow

Custom Synchronization

# Run sync script locally
python scripts/sync_leetcode.py --days 7  # Sync last 7 days
python scripts/sync_leetcode.py --all     # Sync all solutions

πŸ“– Documentation

Solution Documentation Structure

Each solution includes:

# Problem Title

## Difficulty: [Easy/Medium/Hard]
## Topics: [Array, String, Dynamic Programming, etc.]

## Problem Description
[Detailed problem statement]

## Approach
- Time Complexity: O(n)
- Space Complexity: O(1)
[Detailed approach explanation]

## Solution Stats
| Metric  | Value |
|---------|-------|
| Runtime | x ms  |
| Memory  | x MB  |
| Date    | YYYY-MM-DD |

## Code Implementation
[Solution with comments]

## Test Cases
[Example test cases]

πŸ› οΈ Tech Stack

Core Technologies

  • Python 3.10+: Core implementation
  • GitHub Actions: Automation workflow
  • Docker: Containerization (optional)

Dependencies

  • PyGithub: GitHub API integration
  • requests: HTTP client for LeetCode API
  • python-dotenv: Environment management
  • pytest: Testing framework
  • black: Code formatting
  • isort: Import sorting

Development Tools

  • pre-commit: Git hooks
  • flake8: Linting
  • mypy: Type checking

πŸ‘₯ Contributing

We welcome contributions! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch
    git checkout -b feature/amazing-feature
  3. Commit your changes using conventional commits
    git commit -m 'feat: add amazing feature'
  4. Push to your branch
    git push origin feature/amazing-feature
  5. Open a Pull Request

Commit Convention

feat: New feature
fix: Bug fix
docs: Documentation update
style: Code style update
refactor: Code refactoring
test: Test update
chore: Build tasks update

πŸ“Š Analytics

Track your LeetCode progress with built-in analytics:

  • Solution success rate
  • Runtime percentile
  • Memory usage percentile
  • Problem-solving patterns
  • Time complexity distribution
  • Language usage statistics

πŸ—ΊοΈ Roadmap

Phase 1 (Q1 2024)

  • Solution performance analytics dashboard
  • Multiple language template support
  • Automatic complexity analysis

Phase 2 (Q2 2024)

  • Integration with LeetCode contests
  • Custom solution tagging system
  • AI-powered solution suggestions

Phase 3 (Q3 2024)

  • Interactive learning paths
  • Community contribution features
  • Performance optimization tools

πŸ“¬ Contact

Connect with me:

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


⬆ back to top

Built with ❀️ by TheToriqul

About

An enterprise-grade automation system that synchronizes, organizes, and documents your LeetCode solutions with comprehensive analytics and documentation.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors