Below is our question detail page. It includes several useful sections, which can meet all your programming requirements whether you are a newbie or a professional. Read on to learn more about how to use each of the sections for your coding practice.
Question Content
In this section, the first thing you see is the question title, and right below it you can find some interactive features such as like/dislike voting, collection, and sharing. Below the question description, we provide information on the total number of accepted submissions v.s. the total number of submissions, so that you can get a more realistic idea about the difficulty of your selected question.
In addition, you can switch between the tabs that are located above the question title to use more features.
The tabs include the question's Description, Solution, Submissions and Discuss. Proactively submitting excellent answers and engaging in discussions will help you improve your coding ability and gain reputation in our community.
Question Picker
The question picker section lets you pick a random question to work on and track your progress in your selected subset of questions.
More importantly, you can search and filter our database of questions or switch between your custom lists of questions through the question picker.
Code Editor
LeetCode is working on providing the best online coding experience for you. In the code editor, we start you off with default code templates based on the question and your choice of language. In order to achieve these unique features, our team integrates the editor with different context and coding environments. Many thanks to the CodeMirror Team for helping us make this possible.
Language Information:Shows environments for the currently supported programming languages of online judger.
Language Dropdown:Select the language you want to use and the editor will automatically adjust the corresponding code template. Currently, we have pretty good support for the following languages: C++, Java, Python, C, C#, JavaScript, Ruby, Swift, Go, Scala, Kotlin, Rust, MySQL, Bash.
Editor Shortcuts:We support most common shortcuts, and we also support some special shortcuts for you to execute the code. You can click on the button to see the available editor shortcuts.
Retrieve Last Submitted Code:After clicking this button, the editor will extract the last submitted code for you into your editor.
Reset to Default Code Definition:Clicking this button will reset the entire editor to the original code template.
Playground:Use our Playground tool to debug your code. After using this feature, the driver code associated with the current question will also appear in the newly created Playground.
Editor Settings:You can set the font, theme, key bindings, and tab size inside the editor settings.
Full Screen:Expanding code editor area to full screen will give you more programming space.
Testing Tools
When you need to test your code, you can run it by clicking on the "Run Code" button. Once the code is executed, the console will automatically expand and display the output based on the default test case.
Testcase: In the console, in addition to previewing the execution results of your code, you can modify and make your own test cases. Just click on the "Testcase" tab, modify or enter your test case in the input box, and click "Run Code".
Run Code Result: "Run Code" feature is provided to help you debug your code. After clicking "Run Code", the system will execute your code and output the result based on the current test case. When execution of your code is completed, the system will generate information on input & output, for example, input, your output, and expected output. If your code has a compile error or other errors, they will also appear in the "Run Code Result" panel.
Submit: When after testing your code you decide to submit your code for judging, click on the "Submit" button. Once submitted, your code will be analyzed in a more systematic way through our online judging system. Your code will be evaluated against hundreds of thousands of test cases on the backend to ensure it meets various time and space restrictions and passes corner cases. When the judgment is completed, the system will automatically display the results in the "Submissions" tab.
Note: Each submission will be recorded in your submission history, and excessive submissions may affect your acceptance rate. Therefore, please carefully check and debug your code before submitting. Please do not use "Submit" too frequently so as not to affect your LeetCode ranking which is displayed on your public profile.