A Chrome extension to supercharge your LeetCode problem-solving with AI-powered guidance.
- Project Overview
- Features
- Browser Support
- Prerequisites
- Screenshots
- How It Works
- Installation
- File Structure
- Technologies Used
- Contributing
The LeetCode Learning Assistant is a Chrome extension designed to enhance your LeetCode problem-solving experience. It integrates directly into LeetCode problem pages, providing a sleek, sliding panel with AI-powered guidance using the Gemini 2.5 Flash API.
From high-level hints to complete Java solutions and complexity analysis, this tool supports coders at all levels with a structured, step-by-step learning path. Its modern UI, robust error handling, and secure API key management make it a must-have for mastering coding challenges.
-
Seamless Integration : Adds an "Analyze Problem" button on LeetCode problem pages.
-
Structured Guidance :
- Hints : 3-4 concise, numbered hints to spark logical thinking without revealing solutions.
- Algorithmic Approach : Outlines the optimal data structure and algorithm with numbered steps.
- Pseudocode : Language-agnostic pseudocode in numbered steps for clarity.
- Solution : Complete, well-commented Java code with a flow explanation.
- Complexity Analysis : Time and space complexity with concise reasoning.
-
Modern UI : Responsive sliding panel with custom scrollbar and syntax-highlighted code.
-
Secure API Key Storage : Save your Gemini API key via the extension popup.
-
Robust Error Handling : Clear error messages and retry logic for API failures.
-
Formatted Responses : Markdown-formatted output with proper code blocks for readability.
The extension is fully tested and supported on:
- Google Chrome
- Microsoft Edge
It also work on other Chromium-based browsers (e.g., Brave, Opera), but official support to Chrome and Edge.
Before installing, ensure you have:
- Google Chrome or Microsoft Edge (latest version recommended).
- A valid Gemini API key from Google AI Studio.
- Click the extension icon in the browser toolbar to open the API Key popup.
- Enter your Gemini API key in the input field.
- Click "Save Key" to store the key securely.
- Verify the confirmation message (green for success, red for errors).
- Navigate to a LeetCode problem page (e.g.,
https://leetcode.com/problems/two-sum/
). - Click the "Analyze Problem" button to open the sliding assistant panel.
- Use the "Reveal" buttons to access:
- Hints : 3-4 short hints to guide your thinking.
- Approach : Data structure and algorithm details.
- Pseudocode : Step-by-step pseudocode for the optimal solution.
- Solution : Java code with comments and explanation.
- Complexity : Time and space complexity analysis.
- Click the close button (×) to hide the panel.
Follow these steps to set up the extension:
-
Clone or Download the Repository:
git clone https://github.com/saksham2882/LeetCode-Learning-Assistant.git
Or download and extract the ZIP file.
-
Open Extensions Page:
- Chrome: Go to
chrome://extensions/
. - Edge: Go to
edge://extensions/
.
- Chrome: Go to
-
Enable Developer Mode:
- Toggle "Developer mode" (top-right) to ON.
-
Load Unpacked Extension:
- Click "Load unpacked" and select the
leetcode-learning-assistant
folder.
- Click "Load unpacked" and select the
-
Set API Key:
- Click the extension icon in the browser toolbar.
- Enter your Gemini API key in the popup and click "Save Key".
-
Verify Setup:
- Visit a LeetCode problem page (e.g.,
https://leetcode.com/problems/two-sum/
). - Confirm the "Analyze Problem" button appears.
- Visit a LeetCode problem page (e.g.,
leetcode-assistant/
├── background.js # Service worker for Gemini API calls
├── content_script.js # Injects UI and handles LeetCode page interactions
├── icons/ # Extension icons
├── screenshots/ # screenshots
├── manifest.json # Extension configuration
├── panel.html # HTML for the assistant panel
├── popup.html # HTML for the API key settings popup
├── popup.js # Logic for the popup
└── styles.css # Styles for the button and panel
Technology | Description |
---|---|
HTML5 | Structures the popup and assistant panel UI. |
CSS3 | Styles the UI with responsive design and animations. |
JavaScript | Powers the extension’s logic and API communication. |
Gemini 2.5 Flash Model API | Generates AI-powered hints, approaches, pseudocode, solutions, and complexity analysis. |
Chrome Extension APIs | Enables storage (chrome.storage ), messaging (chrome.runtime ), and tab interactions (chrome.tabs ). |
We welcome contributions to enhance the LeetCode Learning Assistant! To contribute:
-
Fork the Repository:
git fork https://github.com/saksham2882/LeetCode-Learning-Assistant.git
-
Create a Feature Branch:
git checkout -b feature/your-feature-name
-
Make Changes: Implement your feature or bug fix.
-
Test Locally:
- Load the updated extension in Chrome/Edge via "Load unpacked".
- Test on multiple LeetCode problems to ensure compatibility.
-
Commit and Push:
git commit -m "Add your feature description" git push origin feature/your-feature-name
-
Submit a Pull Request: Open a PR on GitHub with a detailed description of changes.
-
Report Issues: Open an issue for bugs or feature suggestions.