The Codility test: what your score actually measures
Most people fail a Codility test believing they passed it. The examples in the task statement all printed the right answer, the editor said OK, the submission went through — and the report came back at 40%. The reason is simple and it is worth knowing before you sit one: the examples you can see are not part of the score.
What the score is actually made of
Every task is graded on two separate axes, and they are reported separately.
- Correctness — the share of hidden test cases where your output matches the expected one. A task runs at least six assessed cases, and your task score is the percentage of them that pass. The examples shown in the statement are demonstrations, not assessed cases.
- Performance — whether the solution stays inside the time and memory limits as the input grows. This applies only to tasks where scalability is part of the point, and it is graded even when your answers are all correct.
That second axis is the one people do not plan for. A correct O(n²) loop on a task designed around O(n log n) returns the right answer on every case it finishes and still loses most of the performance points, because the large cases time out.
Read the constraints as a complexity budget
The constraints block is not decoration. It is the task telling you which complexity it will accept, and it is the single most useful thing on the page.
- N up to 100,000 or more — anything quadratic will time out. You are being asked for sorting, a hash map, two pointers, or a prefix sum.
- N up to a few thousand — O(n²) is usually fine, and reaching for something clever costs you time you will need elsewhere.
- Values up to 2 billion — the task is telling you that a 32-bit accumulator will overflow. In a language where that matters, it matters here.
Work out the target complexity before you write a line. On a machine-graded test there is nobody to award marks for a good instinct you never implemented.
Where the points actually go
Three patterns account for most of the lost score, and none of them are about algorithmic ability.
- Edge cases nobody tested. Empty input, a single element, all elements equal, the minimum and maximum allowed values. These are exactly the hidden cases, because they are the cheapest ones to write.
- Off-by-one at the boundary. Inclusive versus exclusive ranges cost more Codility points than any data structure.
- Running out of time on task three. The timer covers the whole test, not each task. A person who leaves a working brute force on every task usually outscores a person with one perfect solution and two blanks.
Partial credit is real, so use it
Because the score is a percentage of cases, an honest brute force is worth a great deal more than an empty editor. The sequence that scores best under time pressure is almost always the same: write the obvious solution, submit it, then optimise it and submit again. You bank the points first and improve them second.
If you know your solution is too slow and you cannot fix it, leave it. A timed-out submission on the large cases still collects every small and medium case it passes.
The last ten minutes
Stop writing new code. Run each task once with an empty input, once with a single element, and once with the largest value the constraints allow. That pass finds more points than a fourth attempt at the hard task, and it takes three minutes.
One more thing worth knowing rather than discovering afterwards: the platform records what happens in the tab, including focus changes and pasted blocks, and the employer sees that summary next to your score. Plan your test as something you sit and finish, not something you assemble from other windows.
FAQ
Do the examples in the task count towards my Codility score?
No. The examples in the statement are illustrations. Your score is the percentage of hidden assessed test cases your solution passes, which is why a solution that handles every printed example can still score low.
What is a passing Codility score?
There is no universal pass mark — the employer sets it. In practice most companies look at the total percentage across tasks and at whether performance scores show you recognised the intended complexity.
Can I go back to an earlier task?
In most Codility test configurations yes, the whole test shares one timer and you can move between tasks until it runs out. That is exactly why banking a brute force early and returning to optimise it works so well.
Does Codility detect tab switching or pasted code?
The platform logs focus changes and large pastes and reports them to the employer alongside the score. It does not fail you automatically, but the summary is visible to whoever reads your report.