Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

noworneverev/leetcode-api

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/noworneverev/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 - LeetCode questions sorted by likes - Daily updated LeetCode database

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

Languages

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /