One click on a problem page saves your code and the problem description to your own repository, neatly organised and ready to show off.
A button sits in the corner of every problem page. Press it and your current editor contents are committed.
The problem description is converted to Markdown and saved as a README beside your solution.
Whatever language the editor is set to decides the file extension, from
.py to .rs.
Re-solving a problem adds solution_02, solution_03
and so on, unless you ask it to overwrite.
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).
owner/repo. The extension checks that the repo exists,
that your token can write to it, and picks up the default branch by itself.
api.github.com. See the
privacy policy.
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.
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.
| 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. |
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.
Yes. Enter it as org-name/repo. The token has to be authorised for that
organisation.
Not from the UI yet. The LeetCode/ prefix is currently fixed in the
extension.
If you can open the problem and see the editor, it uploads the same way. The extension has no special access of its own.