Codility - Genomic Range Query

Solution to Codility lesson3-exercise3 Genomic Range Query problem, link to Codility problem and complete solution at the end of the post. Definitions: S: string of size N, consisting of characters A, C, G and T. Query: Consists in analyzing the substring S[P[K]] to S[Q[K]] with , and finding the minimal factor, such that A has factor 1, C has factor 2, […]

Read More

Codility - Passing Cars

Solution to Codility lesson3-exercise2 Passing Cars problem, link to Codility problem and complete solution at the end of the post. Definitions: Pair: A pair can be described by a tuple , such that ; Problem: Define a function solution with input A, such that solution returns the numbers of pairs in array A. If the count is […]

Read More

Codility - Count Divisible

Solution to Codility lesson3-exercise1 Count Divisible problem, link to Codility problem and complete solution at the end of the post. Definitions: Problem: Define a function solution with input A, B and K, such that solution returns the number of integers divisible by K , belonging to the interval [A, B]. Expected worst-case time complexity is O(1); Expected worst-case space […]

Read More