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.

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
Install dependencies:
pip3 install requests python-dotenv
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
python3 leetcode.py
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
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
Requires a valid LeetCode session cookie GitHub token must have repo write access Some API requests may fail if rate-limited
The current version is designed specifically for LeetCode 75 problems only.
This tool will evolve into a universal coding sync system, meaning:
It will NOT be limited to LeetCode 75 anymore.