(If you are a Recruiter using HackerRank for Work and looking for information about Test Cases, refer to the Defining Test Cases for Coding Questions topic. )
In your HackerRank Coding questions, test cases help your test setter to validate your coding logic to address all the different scenarios in a problem and verify your output against the expected output. These test cases can be categorized as Sample and Hidden Test Cases.
Sample Test Cases
Sample Test Cases are those which are executed first when you run your code. These test cases validate your logical solution over simple use cases and verify your output against the exact expected output.
To help you gain a better understanding of the problem and the type of input and output expected from your coding logic, your test setter may include one or more sample test cases in your coding question. Only the Sample test cases display the execution result along with the particular input values, the output from your code and the expected output.
For a coding Question to return the highest possible integer in an array, following is the Sample Test case execution status in a HackerRank coding Test.
Tip: You can also download the sample input and output values for a coding Question from the output area in your Tests as shown in the illustration below. The input and output values will be available in separate files.
Note: Only when the sample test cases are successful to return the expected output from your solution, the other edge scenarios-based test cases or the Hidden Test Cases will be executed for validation.
The Sample test cases may or may not involve a score for successful execution. In many cases, these are included for your better understanding of the problem and initial validation of your coding logic.