Skip to content

LeetCode API - Daily updated LeetCode question database with sorting/filtering

License

Notifications You must be signed in to change notification settings

noworneverev/leetcode-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LeetCode API / LeetCode Sorted

Deployed on Vercel FastAPI License

"Yet Another LeetCode API" - Because why reinvent the wheel? (But we did anyway 🛠️)

🚀 Core Services

⚡ Quick Start

# Get today's daily challenge
curl https://leetcode-api-pied.vercel.app/daily

# Find a problem by ID/slug
curl https://leetcode-api-pied.vercel.app/problem/1
curl https://leetcode-api-pied.vercel.app/problem/two-sum

# Get user profile (try your LeetCode username!)
curl https://leetcode-api-pied.vercel.app/user/lee215

🔍 API Endpoints

Endpoint Method Description Example
/problems GET All LeetCode problems /problems
/problem/{id_or_slug} GET Get problem by ID/slug /problem/1
/problem/two-sum
/search/{query} GET Search for problems /search?query=two%20sum
/random GET Random LeetCode problem /random
/user/{username} GET User profile & stats /user/lee215
/user/{username}/contests GET User's recent contests /user/lee215/contests
/user/{username}/submissions GET User's recent submissions /user/lee215/submissions
/daily GET Today's coding challenge /daily

🛠️ Local Setup

  1. Clone the repo

    git clone https://github.com/yourusername/leetcode-api.git
    cd leetcode-api
  2. Set up virtual environment (recommended)

    python -m venv venv
    source venv/bin/activate  # Linux/MacOS
    venv\Scripts\activate     # Windows
  3. Install dependencies

    pip install -r requirements.txt
  4. Run the server

    python run.py

    Visit http://localhost:8000/docs for local Swagger docs!

🔄 Daily Updated Full Problems JSON

Get the latest LeetCode problems. Either run:

python -m src.utils.download

or download leetcode_questions.json(updated daily) directly from the data folder.

🤔 Why This API?

  • Always Fresh Data 🥬 Auto-updating cache system (no stale LeetCode questions!)

  • Vercel-Ready ⚡ One-click deployment with serverless architecture

  • No API Keys 🔓 Free to use with sensible rate limits

  • Real LeetCode Data 🔥 Direct integration with LeetCode's GraphQL API


Disclaimer: This project isn't affiliated with LeetCode. Use at your own risk.

Made with ❤️ by Yan-Ying Liao

About

LeetCode API - Daily updated LeetCode question database with sorting/filtering

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages