A Chrome extension that analyzes the time complexity (TC) and space complexity (SC) of your LeetCode solutions using Google's Gemini AI.
Follow these steps to load the extension in Chrome:
- Download or Clone this repository to your local machine
- Open Chrome and navigate to
chrome://extensions/ - Enable Developer mode (toggle in the top-right corner)
- Click Load unpacked
- Select the folder containing the extension files
- The LeetComplexity extension should now appear in your extensions list
- Click on the LeetComplexity extension icon in your Chrome toolbar
- Enter your Google Gemini API Key in the input field
- Click Save API Key
- You should see a success message confirming the key was saved
Note: You can get a free API key from Google AI Studio
- Navigate to any LeetCode problem (e.g.,
https://leetcode.com/problems/two-sum/) - Write or paste your solution in the code editor
- Important: Scroll the code editor to the top before clicking the analyze button
- Look for the graph/curve button in the top control bar
- Click the button to start analyzing your code
⚠️ Note: Make sure to scroll your code editor to the top before clicking the analyze button. The extension will automatically scroll through your code, but starting from the top ensures all lines are captured correctly.
- A popup will appear in the bottom-right corner showing "Analyzing..."
- The extension extracts your code from the Monaco editor
- It sends the code to Google's Gemini API for complexity analysis
- This usually takes 2-5 seconds
- The popup updates with the analysis results
- Time Complexity is displayed (e.g., O(n), O(n²), O(log n))
- Space Complexity is displayed (e.g., O(1), O(n), O(n+m))
- You can close the popup by clicking the × button
Scroll to the bottom of the description to view the companies that have asked this question.
- ✅ Automatic code extraction from LeetCode's Monaco editor
- ✅ AI-powered complexity analysis using gemini-2.5-flash
- ✅ Beautiful, animated popup with dark mode support
- ✅ Secure API key storage using Chrome's sync storage
- ✅ Clean, modern UI styled with shadcn design system
- ✅ Funnel Display typography for better readability
- Your API key is stored locally using Chrome's secure storage
- Code is only sent to Google's Gemini API for analysis
- No data is stored or shared with third parties
Extension not working?
- Make sure you've added a valid API key
- Check that you're on a LeetCode problem page
- Ensure the Monaco editor is fully loaded
Analysis failed?
- Verify your API key is correct
- Check your internet connection
- Look at the browser console (F12) for error messages
MIT License - feel free to use and modify!
Made with ❤️ for LeetCode enthusiasts




