Skip to content

gehadepada/leetcode-github-sync

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ LeetCode β†’ GitHub Auto Sync

This Python script automatically fetches your accepted LeetCode solutions and pushes them to a structured GitHub repository.

It helps you build a clean, organized archive of your problem-solving progress. image

πŸ“Œ Features

Fetches accepted C++ submissions from LeetCode Automatically retrieves the latest solution for each problem Uploads code to GitHub using REST API Organizes solutions by topic-based folders Prevents duplicate uploads Simple .env configuration

βš™οΈ Requirements

Install dependencies:

pip3 install requests python-dotenv

πŸ” Setup

Create a .env file in the project directory:

LEETCODE_SESSION=your_leetcode_session_cookie GITHUB_TOKEN=your_github_token GITHUB_REPO=your_username/your_repo_name

▢️ How to Run

python3 leetcode.py

πŸ“ Folder Structure Example

The script automatically organizes your repository like this:

Topic 1:Array+String/ Merge Strings Alternately.cpp

Topic 2:Two pointers/ Move Zeroes.cpp

Topic 3:Sliding Window/ Maximum Average Subarray I.cpp

πŸ”„ How It Works

Fetch problem list from LeetCode GraphQL API Find latest Accepted submission Retrieve full C++ code Check if file already exists on GitHub Upload or skip accordingly

⚠️ Notes

Requires a valid LeetCode session cookie GitHub token must have repo write access Some API requests may fail if rate-limited

🚧 Future Version (Important Update)

The current version is designed specifically for LeetCode 75 problems only.

πŸ”₯ Next Version Goals:

This tool will evolve into a universal coding sync system, meaning:

It will NOT be limited to LeetCode 75 anymore.

About

Python Script to upload your leetcode Solutions to Your Github Repo

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages