Mastering Codility’s Online Coding Test — My Top Tips
It’s no secret that the process of applying for a job can be quite lengthy. In addition to interviews and possibly completing a home assignment, you may also be asked to take an online coding skills test. One popular platform for these tests is Codility.
The test consists of several programming problems that you will need to solve within a predefined time frame. Every minute counts, so it’s important to use your time wisely.
This guide offers some preparation tips and things to keep in mind during the test to help you succeed.
This post is not affiliated with Codility and is simply a personal account of my experience with the platform. I hope that sharing my experience may be helpful to some readers.
Should you prepare for this test?
It is optional, but I recommend you do.
How can I prepare for a Codility test?
- Focus on one programming language.
Codility’s platform supports various programming languages, including C, Java, Javascript, and Python, so choose the one you feel most comfortable using. - Know the basics.
It is important that you are familiar with basic array, string, and object/dictionary operations, including their parameters, return values, and edge cases. This will help you avoid wasting time during the test by having to look up basic information. - Practice.
Codility offers a variety of lessons, exercises and challenges to help you prepare and improve your skills. The more of them you complete, the better prepared you will be. - Simulate.
Take Codility’s demo test. - Playground.
Use your preferred IDE for writing your solution. When you are finished, paste your code into Codility’s UI. Your familiar IDE will format your code properly, highlight syntax and may even yell at you when you write bad code. This method is also recommended by Codility. - Test your code!
Write simple yet thorough tests that run your solution on variety of inputs and verify that it produces the correct output. I recommend writing these tests before implementing your solution (TDD-style), this will help you understand the problem and consider all edge cases. - Final preparation tip:
I suggest creating templates for the problems you will be solving, each template should include all the boilerplate code needed to test a generic solution. This method will save you precious time during the test.
Here’s a very simple example (in Javascript):
function mySolution(PARAMS_AS_DESCRIBED_IN_PROBLEM_SET) {
IMPLEMENTATION_GOES_HERE
}
// Test cases
console.log(mySolution(INPUT_PARAMS_1))
console.log(mySolution(INPUT_PARAMS_2))
console.log(mySolution(INPUT_PARAMS_3))
It is probably better to use assertions or your preferred testing library to further enhance your testing process, but even just using this simple skeleton can save you a lot of time. To use this skeleton, start by carefully reading the problem you are trying to solve. Then, enter the function parameters described in the problem, add input parameters to the test cases (you can add as many test cases as you want), and finally begin implementing your solution.
During the test
- Breathe 🙂
- Read the test instructions carefully.
- Wisely divide your time between all questions. If you think one question is easier, start with it, but leave enough time for the rest.
- Similar to the preparation stage, use your preferred programming language and IDE. And do not forget to write comprehensive tests to ensure the correctness of your solution.
- Do the best you can, good luck!
Have a few tips of your own? Please share them in the comments section 💪