Extension

🚀 LeetCode Stats Scraper & Recommender

An intelligent Chrome Extension engineered to supercharge your LeetCode progress. It seamlessly integrates advanced data analysis to provide personalized, growth-oriented problem recommendations directly on LeetCode.com, featuring a Live Ranking System that adapts to your performance in real-time.

✨ Features at a Glance

Feature Description Key Technologies/Concepts
Live Ranking System Tracks your “Current Rank” dynamically. Solve problems to rank up, struggle (skip) to ease down. Adaptive Difficulty, Local Storage Persistence
Smart Recommendation Utilizes an in-built Machine Learning engine to suggest the next best problem based on your Dynamic Rank and Topic Expertise. Cosine Similarity, Gaussian Scoring
Expanded Dataset Powered by a massive dataset of the latest 1000 problems (Recent 250 Contests), rich with Zerotrac ratings and Topic Tags. Node.js Pipeline, Data Enrichment
Automatic Scraping Fetches your profile, contest rating, and solved problem history on load. GraphQL (for data fetching)
Native UI Widget Injects a persistent, non-intrusive “Recommended for You” card directly onto the LeetCode interface with a Rank Dashboard. content.js, DOM Manipulation, SVG
Auto-Refresh Detects successful solution submissions and instantly triggers a Rank Up (+10) and fresh recommendations. Event Listeners, Service Worker Orchestration

🛠️ Architecture Overview

The extension employs a robust, event-driven architecture, separating data handling, business logic, and UI injection for maintainability and performance.

Component Role Technical Details
manifest.json Configuration file. Defines permissions and script injection points (content.js, background.js).
background.js The Service Worker (non-persistent). Orchestrates data fetching, manages the Adaptive Rank Logic, and runs the recommendation engine.
content.js Runs on LeetCode pages. Injects the UI widget (with Rank Dashboard), handles the “Refresh” (Skip) action, and watches for successful submissions.
recommendation_engine.js The “Brain” of the system. A standalone JavaScript module implementing Cosine Similarity (Topic Matching) and Gaussian Scoring (Difficulty Targeting) to rank problems.
recent_contest_map.json The Dataset. A pre-generated, enriched map of 1000 questions from the last 250 contests, including tags and Zerotrac ratings.

📈 Ranking & Adaptive Difficulty logic

We introduced a custom Ranking System to visualize and gamify your growth:

  1. Entry Rank: Initialized to your LeetCode Contest Rating (or 1500).
  2. Growth Mode (+100 Offset):
    • Trigger: Successful Solve.
    • Effect: You gain +10 Rank. The engine targets problems ~100 points higher than your new rank to push you.
  3. Ease Mode (+0 Offset):
    • Trigger: 5 Consecutive Skips (Refreshes).
    • Effect: You lose -5 Rank. The engine removes the difficulty buffer and suggests problems at your current rank to help you regain confidence.

⚙️ Installation (For Other Users)

To get started, follow these simple steps to load the extension in Chrome:

  1. Clone/Download this repository to your local machine.
  2. Open Google Chrome and navigate to chrome://extensions.
  3. In the top right corner, enable Developer Mode.
  4. Click the Load unpacked button.
  5. Select the folder containing the extension files (where manifest.json is located).

The “Recommended for You” widget should now appear on LeetCode.com!


💻 For Developers

The dataset generation is managed by a Node.js pipeline, ensuring the recommendation engine always operates on fresh, high-quality data.

Recommendation Engine Mathematics

The core ranking function $\text{Score}(P)$ is a hybrid model designed for personalized growth:

\[\text{Score}(P) = 0.5 \cdot \text{CosineSim}(P, \text{History}) + 0.5 \cdot \text{GaussianScore}(P, \text{CurrentRank})\]

Where: