Codility Count Non Divisible

Опубликовано: 14 Июнь 2026
на канале: Dave Kirkwood
1,673
21

CountNonDivisible is a respectable exercise in lesson 11 on Codility. The aim is to find the number of non-factors in an array for each value in the array.

In this video I make a map of counters for each distinct value in the array. Then, referring to the CountFactors exercise, I count the number of factors for each distinct value. Finally, I create a non-factors array that is populated by subtracting the number of factors of each value from the length of the array.

The solution scores 100%.