Every programming question needs test cases that have to follow a certain format or they will be considered invalid. The different test cases are:
-
Easy test cases: Easy test cases should follow the given conditions:
-
A candidate should manually solve the test case.
-
The constraint size should be minimal as possible.
-
The first two test cases are Easy.
-
Brute force approach can be used to solve the test case.
-
The score should be 5 for a 100 marks question.
-
Example: If you have an array with size n equal to 10^5 constraints, then your n value should be less than equal to 10.
-
-
Medium test case: Medium test cases should follow the given conditions:
-
Brute force approach can be used to solve the test case.
-
The score should be 5 for a 100 marks question.
-
The next three test cases after easy are medium.
-
Example: If you have an array with size n equal to 10^5 constraints, then your n value should be less than equal to 10^3.
-
-
Hard test cases: Hard test cases should follow the given conditions:
-
An optimal approach should be used to solve these test cases.
-
The score should be 15 for a 100 marks question.
-
The next 5 test cases after medium are hard test cases.
-
Example: If you have an array with size n equal to 10^5 constraints, then your n value should be almost 10^5.
-
The format of the test case file should follow the given condition:
-
There must be exactly 10 test cases for each problem.
-
The total score of the test cases must be 100.
-
Suppose the answer to any problem is a single integer or a single character, then it must have multiple test cases.
-
The size of an individual test case should not exceed 8 MB.
-
Generate test cases that are compatible with the auto-generated code snippets. For example, when making a problem involving queries in the test case (example: query to find the sum of numbers in the range [L, R]), please make sure that the generated answers for queries of the test case are in a single line.
The above sample output corresponds to a problem where we have T = 2 test cases. Each test case consists of queries. Referring to the above picture, the first test case has two queries, and the second test case has three queries. Note that you output queries of a particular test case in a single line.
So, do look at the auto-generated code snippets first and then generate the test cases accordingly so that you don’t have to alter the auto-generated code snippets afterward.
This is how you can easily create test cases for programming questions for various difficulties.