Which browsers can be used for taking HackerRank's assessments?
Use the latest versions of Google Chrome or Firefox browsers for a good experience with HackerRank's Tests and CodePair interviews.
I have IDE related technical queries for my Front-end, Back-end or Full-stack based assessment.
See: Front-end, Back-end, Full-stack IDE - FAQs for detailed information.
What are test cases in coding Questions?
In HackerRank's coding Questions, Test cases validate your code to produce the expected results for a particular scenario based on the problem. The test setter defines these test cases and your coding answers are graded based on the number of Test cases that are successful to produce the correct and expected output.
How can I test my code?
- In the code editor, click Run code to compile your logic and execute all the test cases. You can click this button any number of times during a Test or in CodePair interviews.
- If permitted in your Test, use the "Test against custom input" option to validate your logic using your own input values.
Note: Clicking Run Code does not calculate any scores for the Test cases.
How can I submit code and modify my submission later?
Click Submit code to submit your answer in the Test. You can modify a submission and resubmit it any number of times till the Test ends.
What does a “Wrong Answer” status mean?
When a Test case executes your code but does not produce the expected answer, you see a "Wrong Answer" message. Possible causes could be incorrect coding logic, inefficient handling of edge scenarios in your code or a mismatch in the expected and actual output values.
What are “Time Limit Exceeded” and “Run-time” errors?
Your test setters expect optimal solutions for coding Questions. Therefore, for every programming language, we have preset time and memory limits for code execution on our environment. When your code is unable to execute and return an output within the given time and memory limit, it aborts to return the error. You must optimize your code to return faster results.
The HackerRank Environments page describes the pre-set time and memory limits for every programing language.
What programming languages are available in the Test?
HackerRank supports 35 different programming languages and a code editor which automatically adapts itself to a chosen language.
For coding Questions, you can choose only the languages permitted by the test setter to answer the Question. Example: If you're expected to write a solution in C, C# or C++, you will see only these languages available for selection in the editor.
Sample test cases passed but others are failing!
Sample test cases are simple validation scenarios to test your logic, whereas the other Test cases may cover corner scenarios around the problem. Try to understand the constraints in the problem statement and verify the coding or logical approach in your solution to handle different edge scenarios around the problem. Maybe you're solving a different problem than the Question is expecting you to solve.
Why is the output hidden for a few Test cases?
These are called "Hidden test cases" and validate your code to cover edge scenarios for the given problem. Through hidden test cases, test setters expect to understand the problem-solving abilities in Candidates, and therefore, the input and output values are hidden. Candidates are expected to think through the various scenarios around a problem and produce the expected output in test cases.
See: Hidden test cases.
My code works on my local editor but fails on HackerRank. What is the cause?
- Your code doesn't match the expected output. The output produced by your code must exactly match the output expected by the test case, so something like a spelling error in your output will cause you to fail the challenge.
- You're using a different compiler. Check out our Environment page for up-to-date information on how we're compiling your code.
- Your code's behavior is unpredictable. If you're using C/C++, double check for uninitialized variables or invalid memory accesses, as they can cause unpredictable behavior. If you overrun an array or attempt to print the contents of an array cell that was never initialized, your output may look like it's correct but you'll fail the challenge (invisible garbage characters are the worst, we know).
Can my code write to a file?
Check out the Writing State Information to a File tab on our Environment page.
How can I troubleshoot video, audio or web camera issues during CodePair interviews?
In the CodePair window, click the <Troubleshoot> icon and follow the instructions given to test your computer's audio, video, and web camera.
Ensure that you use the latest versions of Google Chrome and Firefox browsers for taking CodePair interviews.