Sample Test Cases

Last updated: May 1, 2025

Overview

In your HackerRank Coding questions, test cases help your test setter validate your coding logic to address all the different scenarios in a problem and verify your output against the expected output. 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. Their purpose is to carry out an initial validation of your coding logic over simple use cases and verify your output against the exact expected output. 

Your test setter may include one or more sample test cases to help you better understand the problem and the type of input and output expected from your coding logic in your coding question. Only the Sample test cases display the execution result and the particular input values, the output from your code, and the expected output.

Example

The following is the Sample test case execution status in a HackerRank coding Test for a coding logic.

Sample test case input and output.png
Sample test case execution status with input and output values presented

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. 

Download (1).png
Downloading sample input and output values

The Sample test cases may or may not involve a score for successful execution. In many cases, these are included to better understand the problem and initial validation of your coding logic.