You can generate a boilerplate code that saves you time while setting up a coding question. This boilerplate code or code stub handles the input and output in the code.
Adding code stubs is strongly recommended to prevent wastage of candidates' time because of minor errors pertaining to the input and output format. The pre-generated code stub allows them to focus on the algorithm required to solve the problem instead of the input and output syntax.
The code stub can be automatically generated for most of the languages by specifying the following:
- Function Name: For the automated code stub generation, you can only specify one function. However, if you require more than one function, then you can select the language and manually type the code stub for that particular language.
- Return Type: The return type of a function defines the type of the value returned by the function. It can be a string, integer, boolean, long integer, integer array etc.
- Function Parameters: Function parameters are the special variables or input arguments used to refer to a particular data provided as an input. Optionally, you can specify the parameters along with their input type. You can specify more than one function parameter, if required.
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.
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.
Function Name: nonRepeated
Return Type: String
However, if you expect candidates to be familiar with the handling of input and output, you might choose not to generate any code stubs. Candidates have to write the complete code from scratch in this case.
Currently, you cannot generate code stub automatically for the following languages:
- Common Lisp (SBCL)
For these languages, you can type the code stub manually in the editor.