This web application serves as an AI-powered tutor to help users analyze and understand LeetCode problems. By providing a LeetCode problem URL, users can get a detailed analysis, multi-language solutions, curated learning resources, and suggestions for similar problems. The application also features an interactive chat to discuss the problem with an LLM.
- In-Depth Problem Analysis: Get a clear breakdown of the problem's core concepts and optimal approach.
- Detailed Explanations: A comprehensive walkthrough of the solution, including pattern analysis, intuition, and complexity analysis.
- Multi-Language Solutions: View optimal, well-commented solutions in Python, Java, and C++.
- Curated Resources: Access a list of high-quality, hard-to-find resources for deeper learning.
- Similar Problem Suggestions: Receive recommendations for similar problems to solidify your understanding.
- Interactive Chat Tutor: Ask clarifying questions and explore concepts in a floating chat window.
- Response Caching: Saves LLM responses to a local cache to speed up subsequent requests for the same problem.
- Backend: Python 3.9+ with FastAPI
- Frontend: Vanilla HTML, Materialize CSS, and JavaScript
- LLM: Google Gemini
- Data Source: LeetCode's Public GraphQL API
Follow these steps to set up and run the project locally.
git clone https://github.com/999thelastpage/leetcodeHelper.git
cd leetcodeHelpera. Create a Virtual Environment:
It's highly recommended to use a virtual environment to manage Python dependencies.
# For Windows
python -m venv venv
venv\Scripts\activate
# For macOS/Linux
python3 -m venv venv
source venv/bin/activateb. Install Dependencies:
Install all the required Python packages from the requirements.txt file located in the backend directory.
pip install -r backend/requirements.txtc. Create the Environment File:
You need to provide your Google Gemini API key.
-
Navigate to the
backenddirectory. -
Create a new file named
.env. -
Add your API key to this file as follows:
GEMINI_API_KEY="YOUR_API_KEY_HERE" GEMINI_MODEL_NAME="gemini-2.0-flash"Replace
"YOUR_API_KEY_HERE"with your actual Gemini API key. Replace"gemini-2.0-flash"with your choice of Gemini model.
-
Start the Backend Server:
Make sure you are in the root directory of the project (
leetcodeHelper) and your virtual environment is activated. Run the following command:python -m uvicorn backend.main:app --reload
The backend server will start, typically at
http://127.0.0.1:8000. -
Open the Frontend:
Open the
frontend/index.htmlfile directly in your web browser. You can do this by right-clicking the file in your file explorer and selecting "Open with" your preferred browser. -
Start Analyzing!
You can now paste a LeetCode problem URL into the input field and start using the application.
