Solve LeetCode problems in VS Code
- VS Code 1.30.1+
- Node.js 8+
NOTE: Please make sure that
Nodeis in your
PATHenvironment variable. You can check this by running:
Sign in to LeetCodein the
LeetCode Explorerwill let you sign in with your LeetCode account.
You can also use the following command to sign in/out:
- LeetCode: Sign in
- LeetCode: Sign out
The supported endpoints are:
Note: The accounts of different endpoints are not shared. Please make sure you are using the right endpoint. The extension will use
Pick a Problem
Directly click on the problem or right click the problem in the
LeetCode Explorerand select
Preview Problemto see the problem description.
Show Problemto directly open the file with the problem description.
Note: If no folder is opened in VS Code, the extension will save the problem files in $HOME/.leetcode/.
You can switch the default language by triggering the command:
LeetCode: Switch Default Language.
Show Top Voted Solution
Show Top Voted Solutionwill display the top voted solution for you.
Submit the Answer
- You can submit the answer by clicking
🙏 Submit to LeetCodeat the bottom of the file. Or you can trigger the command: LeetCode: Submit to LeetCode to submit the active file as the answer.
Test the Answer
To test your answer, right click in the editor and select
Test in LeetCode.
There are 3 ways to test the answer:
- Test with the default cases
- Write test cases in input box
- Test with the written cases in file
Search problems by Keywords
- To manage your LeetCode sessions, just clicking the
LeetCode: ***at the bottom of the status bar. You can switch between sessions or create a new session.
|Setting Name||Description||Default Value|
||Specify to hide the solved problems or not||
||Specify to show the locked problems or not. Only Premium users could open the locked problems||
||Specify the default language used to solve the problem. Supported languages are:
||Specify whether to use WSL or not||
||Specify the active endpoint. Supported endpoints are:
||Specify the relative path to save the problem files. Besides using customized path, there are also several reserved words which can be used here:
||Specify whether the LeetCode status bar will be shown or not.||
When you meet any problem, you can check the Troubleshooting Page first.
Refer to CHANGELOG