In order to start working on your custom coding tasks, head to your task library and click on "Custom Task", then select "Coding Task" from the list of available options. You will be redirected to the custom coding task creation interface, which is split into the following four parts: Task definition, Reference solutions, Initial codes (optional), and Test cases.
The first component, Task definition, is comprised of sections Summary, Function signature and Task description. In Summary, you need to enter information that will help you identify the task once it is operational (Task name and Synopsis), as well as set the task’s time limit (by default it is 40 minutes). Function signature enables you to choose input parameters and the type of return value for your task. You can use one of the predefined signatures in the basic panel or create your own by switching to advanced. Codility custom coding tasks support integers, arrays of integers, strings, array of strings, booleans and arrays of booleans as both types of parameters and return values. If you are interested in using different types, please contact us at email@example.com.
The last element of Task definition, but also one of the most crucial elements of the task creation process, is Task description. Whatever you enter here will serve as an explanation of the task to all your Candidates attempting to solve it. Make sure that it is as clear as possible and that your Candidates have all of the necessary information they need in order to tackle the described problem. Explain any new concept that you are introducing and cannot be considered common knowledge. It is also very important that the solution function is explained in detail.
The macro [[FunctionSignature]] present in the description by default has to be included in the final version of the task’s contents. Once the task is published, this is where the chosen Function signature will appear, with its syntax adjusted to the programming language your Candidate has selected. Bear in mind that without knowing what the function signature is, your Candidates will not be able to write a solution that both compiles in Codility and also returns what it is required to. Another important component of a good task description is a subsection dedicated to task’s assumptions with expected size of the input specified in detail. Include a short example of a specific output expected for a specific input - it is recommended to use one of the Example test cases (explained further in this manual) for this purpose.
See a complete Task description below for reference (click to zoom):
The next component, Reference solutions, is where you need to add one or more solutions that solve the task perfectly. You can add the solutions in any of the supported languages apart from TypeScript-based Angular.js and React.js. Codility will run the test cases against your reference solutions and will consider whatever they return to be the correct answers that your Candidates’ code submissions will be expected to return. All solutions, given the same inputs and regardless of the language they were submitted in, must always return identical results.
In the third component, Initial codes (optional), you can define a pre-existing snippet of code that each of your Candidates will begin their work with. In other words, it will appear in the code editor when your Candidates open the task for the first time. You can instruct them about the acceptable use of Initial code in the task description or in Initial code’s comments. You need a separate Initial code set up for each of the programming languages that you plan to enable for the task.
Test cases, the last part of the task creation interface, is where you determine inputs that will be run against your Candidates’ code submissions. You can choose between two types - Example and Correctness. Example test cases are shown to the Candidate before submission. They are useful when it comes to making sure that the solution works as expected. Therefore it is recommended to add between one and three of them in order to improve Candidates’ experience and the task’s clarity. Example test cases are not part of the assessment, which means that your Candidates’ solutions will not receive any points for returning correct outputs for them (the reason being that it is fairly easy to write a solution that produces a specific output for a specific input). All the Example test cases should be explained in the Task description. Correctness test cases are hidden from the Candidate and they determine the final score. They should be different from Example test cases. The percentage of correctness test cases for which a solution is returning an expected value (as defined via Reference solution) is the percentage score of a Candidate on the task. The acceptable minimum number of Correctness test cases is four, but it is recommended to prepare more than that - it will result in a better distribution of Candidates’ scores and provide more detailed information about the solution.
Integer, array of integers, string, array of strings, boolean and array of boolenas are the types of allowed input data for both Example and Correctness test cases. One test case can contain multiple values divided by a comma. No special formatting is needed if you want to use an integer. Arrays of integers should be put in brackets [ ], and strings in quotation marks ““.
For example, in order to create a Correctness test case that contains an integer 1, an array of integers 1, 2 and 3 as well as a string “one”, you need to set it as follows:
By default each test case consists of one input, called a subcase. However, it is possible to add more than one subcase to a group of test cases. In such cases, points for a test case will only be scored if a solution returns correct output for each of the subcases in the group. In order to include more separate subcases within one test case, click on "Add a subcase".
Remember to save all your progress by clicking on "Save draft" at the bottom of the webpage. Once you’ve saved a draft, you will be able to either publish your task immediately or, to make sure there are no inclarities or errors, request Codility team’s review of your task. Should you choose to have our team review your task, please keep in mind that it may take up to three working days for the task to be analyzed before you receive our feedback. Once the task is published or approved, it will appear in your task drawer in section "Your Custom Library" under "Coding". Access it via test creation menu or the Task library.