LeetCode Tutor is a Chrome extension designed to help users analyze and understand coding problems on LeetCode. By extracting problem details directly from the LeetCode website and sending them to Google AI Studio, the extension provides AI-generated guidance, including solution strategies, key concepts, common pitfalls, and complexity analysis.
- Automatic Problem Extraction: Retrieves the title and description of the active LeetCode problem.
- AI-Powered Analysis: Uses Google AI Studio to generate a solution guide for the problem.
- Interactive UI: Simple popup interface to trigger and view analysis results.
-
Popup Interface (
Popup.js
):- Provides a button to start analyzing the current LeetCode problem.
- Displays analysis results or error messages within the popup.
-
Content Script (
content.js
):- Runs on LeetCode problem pages.
- Extracts the problem title and description.
-
Background Script (
background.js
):- Listens for messages from the popup and retrieves LeetCode problem data from
content.js
.
- Listens for messages from the popup and retrieves LeetCode problem data from
-
(
script.js
):- Manages API calls to external services.
- Helps keep sensitive keys secure by acting as a proxy between the extension and the AI API.
-
Clone the Repository:
git clone https://github.com/(your-name)/leetcode-helper cd leetcode-helper
-
Install Dependencies:
npm install
-
Add Environment Variables:
- Create a
.env
file in the root directory:API_KEY=your-google-api-key
- Replace
your-google-api-key
with your Google Gemini API key.
- Create a
-
Load the Extension into Chrome:
- Open Chrome and go to
chrome://extensions/
. - Enable "Developer mode."
- Click "Load unpacked" and select the
chrome-extension
directory.
- Open Chrome and go to
- Navigate to a LeetCode Problem Page: Go to any problem on LeetCode.
- Open the Extension: Click on the extension icon in the Chrome toolbar to open the popup.
- Analyze the Problem: Click the "Analyze Problem" button. The extension will extract the problem details and provide AI-generated insights on solving it.
- HTML, CSS: For building the popup UI.
- Google AI Studio: Provides the AI-generated solution analysis.