A browser extension for competitive programming enthusiasts that generates progressive, rubric-enforced hints for competitive programming problems
Visit for more info: https://algohint-web.vercel.app/
## Table of Contents
- Overview
- Features
- Architecture
- Prerequisites
- Installation Guide
- Usage Guide
- Security & Privacy
- Troubleshooting
- Contributing
- License
AlgoHint is a privacy-first, offline-capable hint generation system designed for competitive programming enthusiasts. By leveraging a local LLM and LangGraph orchestration, it provides intelligent, progressive hints that help you learn problem-solving techniques without spoiling the complete solution. The system works seamlessly across both Codeforces and LeetCode platforms, ensuring you get the right nudge at the right time.
- Cross-Platform Support: Works seamlessly on both Codeforces and LeetCode problem pages.
- Local AI Privacy: Powered entirely by a local LLM (
qwen2.5:0.5bvia Ollama), ensuring zero data leakage and 100% offline hint generation. - Progressive Hint Levels: 4 distinct levels of hints ranging from abstract open-ended nudges (L1) to specific technique names (L4).
- Intelligent Anti-Spoiler Guard: An LLM-based verification node evaluates each generated hint against a strict per-level rubric to ensure it never gives away the exact code or steps prematurely.
- Automatic LeetCode Data Fetching: Utilizes LeetCode's public GraphQL API to dynamically fetch problem statements, official editorials, or top community solutions (if premium-locked) without requiring any manual scanning.
- Live Contest Anti-Cheat: For Codeforces, hint generation is intentionally disabled during active live contests to prevent cheating.
flowchart TD
subgraph Browser Extension
direction LR
A[Shadow DOM Hint Sidebar]
B[LeetCode GraphQL Fetcher]
C[Codeforces Tutorial Extractor]
B --> A
C --> A
end
subgraph FastAPI Server
direction TB
subgraph LangGraph Pipeline
D[Input Node] --> E[Hint Gen]
E --> F[Safety Guard]
F --> G[Output Node]
end
B -. HTTP .-> D
C -. HTTP .-> D
E <--> H[(Ollama qwen2.5:0.5b)]
F <--> H
end
Before you begin, ensure you have the following installed:
- Python 3.10+ - For running the backend server
- Ollama - You must have Ollama installed and running on your machine
- Chrome, Edge, or Brave Browser - For installing the browser extension
Before the extension can generate hints, you need to run the local FastAPI server.
-
Open your terminal and navigate to the project backend directory:
cd local_dev -
Create and activate a Python virtual environment:
python -m venv .venv source .venv/bin/activate # On Windows, use `.venv\Scripts\activate`
-
Install the required dependencies:
pip install -r requirements.txt pip install fastapi uvicorn pydantic bs4 markdownify
-
Ensure Ollama has the correct model downloaded:
ollama pull qwen2.5:0.5b
With your virtual environment activated, start the FastAPI server:
python server.pyYou should see Uvicorn start on http://127.0.0.1:8000. Leave this terminal running in the background.
- Open your Chromium-based browser (Chrome, Edge, Brave).
- Go to the extensions management page:
- Chrome: Navigate to
chrome://extensions/ - Edge: Navigate to
edge://extensions/
- Chrome: Navigate to
- Turn on Developer Mode (usually a toggle in the top right corner).
- Click the Load unpacked button.
- Select the
extensionfolder from your cloned repository.
The extension is now installed and active!
LeetCode integration is fully automatic:
- Navigate to any LeetCode problem page (e.g.,
/problems/two-sum/). - The AlgoHint Sidebar will automatically appear. The extension fetches the problem statement and the official editorial (or top community solution) via GraphQL in the background.
- Select your desired hint level to generate a hint.
Because the AI needs the editorial to verify that its hints are helpful and relevant, you must first "scan" the tutorial for the contest you are practicing:
- Go to any Codeforces Tutorial/Editorial page (e.g., Codeforces Round 1098 Editorial).
- Click the new AlgoHint extension icon in your browser toolbar.
- Click 1. Extract Page. You will see a small preview of the text.
- Click 2. Store Tutorial. The extension saves the editorial to your local browser storage.
- Navigate to a problem page for that contest (e.g.,
/contest/1098/problem/A). - You will automatically see the sidebar appear in the bottom right corner of the page.
Select your desired hint level in the sidebar:
| Level | Name | Description |
|---|---|---|
| L1 | Open Question | Most abstract - broad, thought-provoking questions |
| L2 | Structural Observation | Focuses on data structures and patterns |
| L3 | Math/Insight | Mathematical properties and key insights |
| L4 | Technique Name | Most revealing - names the specific algorithm/technique |
Wait a few seconds while your local AI generates and verifies the hint against its safety rubrics. The result will appear directly in the sidebar!
AlgoHint prioritizes your privacy and security:
- Zero Data Leakage: All hint generation happens locally on your machine
- Offline Operation: No external API calls - everything runs through your local Ollama instance
- Live Contest Protection: Automatic detection and disabling of hints during active Codeforces contests
- Anti-Spoiler Guard: Multi-stage verification ensures hints never reveal complete solutions
Issue: Backend not starting
- Solution: Ensure Python 3.10+ is installed and all dependencies are correctly installed
Issue: Extension not appearing on LeetCode
- Solution: Refresh the page and ensure the backend server is running
Issue: "Tutorial not found" on Codeforces
- Solution: Make sure you've extracted and stored the tutorial from the editorial page
Issue: Model not found error
- Solution: Run
ollama pull qwen2.5:0.5bto download the model
Issue: Sidebar not showing
- Solution: Check that the backend is running on
http://127.0.0.1:8000and reload the page
We welcome contributions! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
For development, you can run the backend in debug mode:
uvicorn server:app --reloadThis project is licensed under the MIT License - see the LICENSE file for details.
Made with ❤️ by Harshit Kandpal
