Categories
coding solutions

Codility: CommonPrimeDivisors Solution

Task Check whether two numbers have the same prime divisors.: 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 prime D is called a prime divisor of a positive integer P if there exists […]

Categories
coding solutions

Codility: NailingPlanks Solution

Task The task is to count the minimum number of nails that allow a series of planks to be nailed.: You are given two non-empty arrays A and B consisting of N integers. These arrays represent N planks. More precisely, A[K] is the start and B[K] the end of the K−th plank. Next, you are […]

Categories
coding solutions

Codility: FibFrog Solution

Task The task is to search for the optimal solution to a problem involving summing Fibonacci numbers: A small frog wants to get to the other side of a river. The frog is initially located at one bank of the river (position −1) and wants to get to the other bank (position N). The frog […]