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 ,   − counter is increased by one, − all […]

Read More

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 space complexity is O(N), […]

Read More

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 returns 1 if A is […]

Read More

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 such index, the function should return -1. […]

Read More