A Chrome extension that automatically syncs your LeetCode solutions to your GitHub repository as .java files with proper naming conventions and source URLs.
- Automatic Java File Creation: Converts any LeetCode solution to
.javaformat - Smart File Naming: Uses camelCase convention (e.g., "Two Sum" →
twoSum.java) - Source URL Tracking: Adds the LeetCode problem URL as a comment at the top of each file
- GitHub Integration: Direct upload to your specified GitHub repository
- Manual Code Capture: Easy-to-use interface for capturing and uploading solutions
- File Overwriting: Updates existing solutions automatically
- Secure Token Storage: Your GitHub token is stored locally and encrypted
- Download or clone this repository
- Open Chrome and navigate to
chrome://extensions/ - Enable "Developer mode" (toggle in top right)
- Click "Load unpacked" and select the extension folder
- The extension icon should appear in your toolbar
*Coming soon
- Go to GitHub Settings → Developer settings → Personal access tokens
- Click "Generate new token (classic)"
- Give it a descriptive name like "LeetCode Extension"
- Select the following scopes:
repo(Full control of private repositories)public_repo(Access to public repositories)
- Click "Generate token" and copy the token immediately
- Click the extension icon in your Chrome toolbar
- Paste your GitHub token in the "GitHub Token" field
- Enter your repository in the format:
username/repository-name- Example:
johnsmith/leetcode-solutions
- Example:
- Click "Save Configuration"
- Navigate to any LeetCode problem page
- Write and test your solution in the LeetCode editor
- Click the green "📤 Capture & Upload to GitHub (.java)" button that appears on the page
- Follow the popup instructions:
- Select all your code (Ctrl+A)
- Copy it (Ctrl+C)
- Click OK
- Your solution will be automatically uploaded as a
.javafile
Your solutions will be saved with the following structure:
your-repo/
├── twoSum.java
├── addTwoNumbers.java
├── longestSubstringWithoutRepeatingCharacters.java
└── ...
Each file includes:
- URL Comment: The LeetCode problem URL at the top
- Your Solution: The complete Java code you wrote
Example file content:
//https://leetcode.com/problems/two-sum/
class Solution {
public int[] twoSum(int[] nums, int target) {
// Your solution here
}
}- Converts problem titles to camelCase
- Removes special characters and numbers
- Examples:
- "1. Two Sum" →
twoSum.java - "Add Two Numbers" →
addTwoNumbers.java - "Longest Substring Without Repeating Characters" →
longestSubstringWithoutRepeatingCharacters.java
- "1. Two Sum" →
- GitHub tokens are stored locally using Chrome's secure storage API
- No data is sent to external servers except GitHub's official API
- All operations are performed client-side
activeTab: To read the current LeetCode pagestorage: To save your GitHub configurationclipboardRead: To capture code from clipboardscripting: To inject the capture button- Host permissions for LeetCode and GitHub API
"Please configure GitHub token first"
- Make sure you've entered a valid GitHub personal access token
- Verify the token has
repopermissions - Check that your repository exists and is accessible
"Upload failed: Configuration missing"
- Double-check your repository format:
username/repo-name - Ensure your GitHub token hasn't expired
- Verify the repository exists
"No code found in clipboard"
- Make sure to copy your code (Ctrl+C) before clicking the capture button
- Try refreshing the page and attempting again
- Ensure clipboard permissions are granted to the extension
Extension button not appearing
- Refresh the LeetCode problem page
- Make sure you're on a
/problems/URL - Check that the extension is enabled in
chrome://extensions/
- If automatic capture fails, use the extension popup
- Copy your code and paste it manually in the popup
- The problem title should auto-populate from the current page
Contributions are welcome! Please feel free to submit issues and pull requests.
- Clone the repository
- Make your changes
- Test by loading as unpacked extension
- Submit a pull request
- Support for multiple programming languages
- Batch upload functionality
- Custom file organization options
- Solution statistics and tracking
If you encounter any issues or have feature requests:
- Check the troubleshooting section above
- Open an issue on GitHub
- Include your Chrome version and extension version in bug reports
Happy Coding! 🚀
Star this repository if you find it helpful!