GitHub - khafifithebork/LeetcodeJourney: My Leetcode Journey so far.

๐Ÿง  LeetCode Solutions

LeetCode Sync LeetCode GitHub last commit

My personal collection of LeetCode solutions, automatically synced via GitHub Actions.

LeetCode Profile ยท View Solutions ยท How It Works


๐Ÿ“ Repository Structure

๐Ÿ“ฆ leetcode
โ”œโ”€โ”€ ๐Ÿ“‚ .github/workflows
โ”‚   โ””โ”€โ”€ ๐Ÿ“„ leetcode-sync.yml   # GitHub Actions workflow
โ”œโ”€โ”€ ๐Ÿ“‚ solutions               # Auto-synced solutions
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ 1-two-sum.py
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ 2-add-two-numbers.py
โ”‚   โ””โ”€โ”€ ...
โ””โ”€โ”€ ๐Ÿ“„ README.md

๐Ÿ”„ How It Works

This repository uses the LeetCode Sync GitHub Action to automatically sync accepted LeetCode submissions to this repo.

  • โฐ Schedule: Syncs every Saturday at 8:00 AM UTC (configurable via cron)
  • ๐Ÿ–ฑ๏ธ Manual Trigger: Can also be triggered manually from the Actions tab
  • ๐Ÿ”’ Secure: LeetCode credentials are stored as encrypted GitHub Secrets

โš™๏ธ Setup Guide

Want to set up your own? Follow these steps:

1. Get Your LeetCode Cookies

  1. Log in to leetcode.com
  2. Open Developer Tools (F12 or Ctrl+Shift+I)
  3. Go to Application โ†’ Cookies โ†’ https://leetcode.com
  4. Copy the values for:
    • csrftoken โ†’ This is your CSRF Token
    • LEETCODE_SESSION โ†’ This is your Session Token

2. Add GitHub Secrets

Go to your repo โ†’ Settings โ†’ Secrets and variables โ†’ Actions, and add:

Secret Name Value
LEETCODE_CSRF_TOKEN Your csrftoken cookie
LEETCODE_SESSION Your LEETCODE_SESSION cookie

3. Enable the Workflow

The workflow file at .github/workflows/leetcode-sync.yml will automatically run on schedule. You can also trigger it manually:

  1. Go to the Actions tab in your repository
  2. Select Sync Leetcode
  3. Click Run workflow

๐Ÿ› ๏ธ Technologies


๐Ÿ“œ License

This project is open source and available under the MIT License.


โญ Star this repo if you find it useful!

Made with โค๏ธ and lots of โ˜•