Solution to Codility lesson15-exercise1 Number Solitarie problem, link to Codility problem and complete solution at the end of the post. Assume that: Definitions: Problem: Starting at index 0. The initial result is the value of the element at index 0. From index i we can move from 1 to 6 indexes, we’ll call this difference k. Then […]

# Codility – Max Counters

Solution to Codility lesson2-exercise4 Max Counters problem, link to Codility problem and complete solution at the end of the post. Definitions: In this problem we have the definition of two operations, with a given N, and a count array for counting elements from 1 to N , […]

# Codility – Missing Integer

Solution to Codility lesson2-exercise3 Missing Integer problem, link to Codility problem and complete solution at the end of the post. Definitions: Problem: Define a function solution with input A, such that solution returns the minimal positive integer (greater than 0) that does not belongs to A. Expected worst-case time complexity is O(N); Expected worst-case […]

# Codility – Permutation Check

Solution to Codility lesson2-exercise2 Permutation Check problem, link to Codility problem and complete solution at the end of the post. Definitions: Codility Permutation definition: A permutation of size N is a sequence containing each element from 1 to N once, and only once. Problem: Define a function solution with input A, such that solution […]

# Codility – Frog River One

Solution to Codility lesson2-exercise1 Frog River One problem, link to Codility problem and complete solution at the end of the post. Definitions: Problem: Define a function solution with input X and A, such that solution returns the minimum index of A where all elements of the sequence , has appeared, if there isn’t […]

# Codility – Permutation Missing Element

Solution to Codility lesson1-exercise3 Permutation Missing Element problem, link to Codility problem and complete solution at the end of the post. Definitions: Problem: Define a function solution with input A, such that solution returns the missing element of the sequence . Expected worst-case time complexity is O(N); Expected worst-case […]

# Codility – Frog Jump

Solution to Codility lesson1-exercise2 Frog Jump problem, link to Codility problem and complete solution at the end of the post. Definitions: Problem: Define a function solution with input X, Y, D, such that solution returns the minimum number of jumps needed to reach a position equal or greater than Y from position X, being […]

# Codility – Tape Equilibrium

Solution to Codility lesson1-exercise1 Tape Equilibrium problem, link to Codility problem and complete solution at the end of the post. Definitions: So, taking P we split the elements of A in two sets . We will define a binary operation diff such that the result of this operation […]