Your LeetCode solutions, committed to GitHub

One click on a problem page saves your code and the problem description to your own repository, neatly organised and ready to show off.

What it does

One-click upload

A button sits in the corner of every problem page. Press it and your current editor contents are committed.

Keeps the question

The problem description is converted to Markdown and saved as a README beside your solution.

Detects your language

Whatever language the editor is set to decides the file extension, from .py to .rs.

Keeps every attempt

Re-solving a problem adds solution_02, solution_03 and so on, unless you ask it to overwrite.

Setup

You need a GitHub repository to push into. Any repository works, as long as it has at least one commit already (a repo created with a README is fine).

  1. Install the extension Once installed, pin it to the toolbar so the icon is always reachable, then click the icon to open the setup wizard.
  2. Connect your GitHub account Paste a personal access token and press Connect. The extension reads your username from the token, so there is nothing else to type. Creating a token takes about a minute.
  3. Choose a repository Type it as owner/repo. The extension checks that the repo exists, that your token can write to it, and picks up the default branch by itself.
  4. Solve something and upload Open any problem, write your solution, then press Upload to GitHub either on the page or in the popup.
Nothing leaves your browser except the commit. Your token is stored in Chrome's local extension storage and is only ever sent to api.github.com. See the privacy policy.

What gets committed

Everything lands under a LeetCode/ folder, one directory per problem:

your-repo/
└── LeetCode/
    ├── 1. Two-Sum/
    │   ├── README.md        the problem description
    │   └── solution_01.py   your code
    └── 226. Invert-Binary-Tree/
        ├── README.md
        ├── solution_01.java
        └── solution_02.java  a later attempt

The folder is named after the problem number and slug shown in the URL. Commits are messaged like 1. Two-Sum: Add solution_01 and README.md.

Overwrite latest solution

The toggle in the popup decides what a second upload of the same problem does. Left off, each upload becomes a new numbered file, so you keep a history of attempts. Turned on, the highest-numbered solution file is replaced in place.

Troubleshooting

Message What to do
Monaco editor not loaded yet Click inside the code editor once so LeetCode finishes loading it, then upload again.
Extension was reloaded. Please refresh this page. The extension updated while the tab was open. Reload the LeetCode page.
Refresh the LeetCode page and try again The page was open before the extension was installed, so its button was never injected. Reload it.
Failed to get HEAD SHA: 409 The repository is empty. Add a README on GitHub to create the first commit, then retry.
Failed to get HEAD SHA: 404 The saved branch no longer exists. Reopen the wizard with the gear icon and re-select the repo.
That token is invalid or has expired Tokens expire. Generate a new one and paste it into the wizard again.
Cannot see owner/repo A fine-grained token only reaches repositories you explicitly listed under Repository access. Check that list.
Your token can read this repo but not write to it Give the token Contents: Read and write permission.
An upload is already in progress Wait for the running upload to finish. It clears itself after a minute if something went wrong.

Questions

Does it read my submissions or only the editor?

It takes whatever is currently in the code editor, not your submission history. You do not have to submit first, though you probably want to.

Can I push to an organisation repository?

Yes. Enter it as org-name/repo. The token has to be authorised for that organisation.

Can I change where the files go?

Not from the UI yet. The LeetCode/ prefix is currently fixed in the extension.

Does it work on premium problems?

If you can open the problem and see the editor, it uploads the same way. The extension has no special access of its own.