All my solutions in the code editor suddenly went missing. How can I retrieve my solutions?
The code you typed into the code editor is stored temporarily in your browser session, however all your submitted solutions were stored permanently.
Fear not, just click on the "code" icon to retrieve your last submitted code.
Where do I find all of my submitted codes?
Go to the submissions page, then click on the status of that submission row to view more details such as your submitted code.
What are the environments for the programming languages of OJ?
Language | Version | Notes |
---|---|---|
C++ | g++ 6.3 | Uses the C++14 standard. |
Java | java 1.8.0 | |
Python | python 2.7.12 | |
Python3 | Python 3.5.2 | |
MySQL | mysql-server 5.7.21 | |
C | gcc 6.3 |
For hash table operations, you may use uthash."uthash.h" is included by default.
|
C# | mono 5.12.0 | Run with /debug flag, with full support for C# 7. |
JavaScript | nodejs 8.8.1 | Run with --harmony flag, enabling new ES6 features.underscore.js library is included by default. |
Ruby | ruby 2.4.1 | |
Bash | bash 4.3.30 | |
Swift | swift 4.2 | |
Go | go 1.10.3 | |
Scala | Scala 2.11.6 | |
Kotlin | Kotlin 1.2.50 | |
Rust | 1.31.0 edition = 2018 |
I encountered Wrong Answer/Runtime Error for a specific test case. When I test my code using this test case, it produced the correct output as shown below. Why?
First, please check if you are using any global or static variables. They are Evil, period. If you must declare one, reset them in the first line of your called method or in the default constructor. Why? Because the judger executes all test cases using the same program instance, global/static variables affect the program state from one test case to another. See this Discuss thread for more details.
Are you using C or C++? If the answer is yes, chances are your code has bugs in it which cause one of the earlier test cases to trigger an undefined behavior. See this Discuss thread for an example of undefined behavior. These bugs could be hard to debug, so good luck. Or just give up on C/C++ entirely and code in a more predictable language, like Java. Just kidding.
Am I allowed to print something to stdout?
Yes. You may print to stdout for debug purposes and it will not affect the judgment of your solution. However, doing so will most likely increase the runtime of your program and you may get Time Limit Exceeded or Output Limit Exceeded due to too much extraneous output.
What does [1,null,2,3]
mean in binary tree representation?
The input [1,null,2,3]
represents the serialized format of a binary tree using level order traversal, where null
signifies a path terminator where no node exists below. StefanPochmann made an interesting tree visualizer tool. Check out some examples below.
[]
Empty tree. The root is a reference toNULL
(C/C++),null
(Java/C#/Javascript),None
(Python), ornil
(Ruby).
[1,2,3]
1 / \ 2 3
[1,null,2,3]
1 \ 2 / 3
[5,4,7,3,null,2,null,-1,null,9]
5 / \ 4 7 / / 3 2 / / -1 9
What is the difference between 'Time Limit Exceeded' and 'Timeout'?
If your solution is judged 'Time Limit Exceeded', it could be:
On the other hand, 'Timeout' simply means the server queue is busy and could not process your submission for the time being. Please wait for about 10 seconds and submit again.
I messed up in the code editor and would like to start from scratch on a particular problem. How do I reset to the default code definition?
Just click on the reset button to reset your code.
I need to start another round of coding practice. Is there a way to reset the checkmarks of all solved problems?
Yes. Just go to the Session Management panel and activate a new session. Your previous session will be saved and you will start fresh. Your progress will now be tracked separately in the newly created session.
Your blog used to have great explanation of the questions and solutions. I am unable to find it anymore. Did you remove them? Is the blog archived somewhere? Can we have access that? Is it possible to bring it back?
No, it is not removed. All articles were migrated to http://leetcode.com/articles. All old links will automatically be redirected to https://leetcode.com/articles, for example: http://leetcode.com/2011/11/longest-palindromic-substring-part-ii.html
How can I switch back to the old UI?
To switch back to the old layout, you can choose "Switch to old version" from the user menu dropdown.