Categories
coding solutions

Codility: count_semiprimes Solution

Task The task is to Count the semiprime numbers in the given range [a..b]: A prime is a positive integer X that has exactly two distinct divisors: 1 and X. The first few prime integers are 2, 3, 5, 7, 11 and 13. A semiprime is a natural number that is the product of two […]

Categories
coding solutions

Codility: Peaks Solution

Codility: Peaks Solution Task Divide an array into the maximum number of same-sized blocks, each of which should contain an index P such that A[P – 1] < A[P] > A[P + 1]].: A non-empty array A consisting of N integers is given. A peak is an array element which is larger than its neighbors. […]

Categories
coding solutions

Codility: Count Factors Solution

Codility: Count Factors Solution Task The task is to Count factors of given number n.: A positive integer D is a factor of a positive integer N if there exists an integer M such that N = D * M. For example, 6 is a factor of 24, because M = 4 satisfies the above […]