For your convenience, HackerRank allows you to upload all test cases for a Coding or Approximate Solution question as a zip file. There is an option to upload a zip file containing all the test cases on the Test Cases tab of a coding question or an approximate solution question. This is useful when our test case editing form is too small to type in a large input or output, the number of test cases is large, or you want to add all test cases by using your editor. The input files in the zip are named input000.txt, input001.txt, etc. The output files are named output000.txt, output001.txt, and so on.
The structure of the directory that is compressed into a .zip file should have the following format:
- It should only contain files without any other sub-directories
- Provide two files for each test case. One file should contain input, and the corresponding file should contain the output for the test case. Name the input file as "input" followed by a number, and save it as .txt file. Similarly, name the output file as "output" followed by a corresponding number and save it as .txt file.
Example:
Input File Name | Corresponding Output File Name |
input000.txt | output000.txt |
input0.txt | output0.txt |
input1.txt | output1.txt. |
- For a given test case, the input and output files need to be associated with each other. The numbers in the input and output file names should match for them to be associated. For example, input0.txt and output0.txt are combined into a test case, as is input002.txt and output002.txt.
Refer to the Create a coding question article to understand the detailed steps involved.
A coding problem example along with sample input and output test cases is given below:
For an integer N, print the string 'Hello World' N times, each in a single line. Write complete compilable code. Your code should not print anything extra to the standard output. Please refer to sample test cases. Input Format A single integer N (read from standard input) Output Format N lines of the string 'Hello World' (printed to standard output) Contents of input00.txt 3 Contents of output00.txt Hello World Hello World Hello World
Contents of input01.txt 5 Contents of output01.txt Hello World Hello World Hello World Hello World Hello World |