Codility – Distinct

Solution to Codility lesson4-exercise3 Distinct 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 number of distinct values in array A. Expected worst-case time complexity is O(N*log(N)); Expected worst-case space complexity is O(N), […]

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 […]

READ MORE

Codility – Number Solitaire

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 […]

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 […]

READ MORE