The problem details are an integral part of creating any question. Particularly for the coding and database-related questions, a good problem statement should comprise a clear and detailed problem description, supporting data schema, at least one sample test case with an explanation, and problem constraints.
HackerRank for Work simplifies this process with predefined templates to describe your Coding and Database Engineer type questions. The templates are a simple and structured format to define your questions clearly.
It is recommended that you use these templates to define your Coding and Database Engineer type question problem details because it provide a structured and clear view of the question to your candidates during Tests and Interviews.
How to Define a Problem Statement?
- While creating a question, navigate to the Problem Details field on the Question Details page.
- On the extreme right of the toolbar, click on the Use content templates option.
The following templates are available for selection:
|HackerRank's Coding Question Template||
Recommended for coding-type questions. Provides the format to define the:
|HackerRank's Database Question Template||
Recommended for Database Engineer-type questions. Provides the format to define the:
- You can select the required template based on your question type. The template format is added to your Problem description area.
- Detail the question as per the format.
Write a program that reads in a string and finds the first non-repeated character in that string. Treat the characters as case sensitive. Therefore, "a" and "A" are different. You will be required to complete a given function nonRepeated.
Char nonRepeated(char * str)
There is one sentence in the input that contains String Str.
Sample Test Case with Explanation
A single character that represents the first character in Str that is not repeated.
Recommended Practices to Define a Problem
Variable naming convention:
- The variables in the problem statement must match those in the code stubs. If you refer to a variable in the problem statement as "N," it should be referred to as "N" (and not "n") in the code stubs as well.
- All variable names and function names should be italicized. For instance, nonRepeated is italicized in the above example.
- Terminology Usage: Be specific and clear when writing a problem statement to avoid ambiguity. For example: When you have to refer to "binary search tree,"; do not use "tree" or "binary tree," but instead use the "binary search tree" phrase.
Input and Output format
- To ensure a smooth experience for the candidates, you must clearly specify the input and output format while defining the problem statement.
- Unless you want the candidates to figure out all possible constraints of a problem, you should mention these constraints clearly.
For example: If the code has to read a number as an input, specify the range of that number. This will help the candidate to decide if int, long int, or long, long int has to be used. If the input is a string, specify the special characters such as:? @ , . ^ % are also present in the string. You can also specify if it contains consecutive spaces.
- Sample Test Case with Explanation
- A sample test case, with input and expected output, is strongly recommended to clarify the problem statement to the candidates.