Problem solutions for Codility lessons
Find longest sequence of zeros in binary representation of an integer.
Rotate an array to the right by a given number of steps.
Find value that occurs in odd number of elements.
Find the missing element in a given permutation.
Count minimal number of jumps from position X to Y.
Minimize the value |(A[0] + ... + A[P-1]) - (A[P] + ... + A[N-1])|.
Check whether array A is a permutation.
Find the earliest time when a frog can jump to the other side of a river.
Calculate the values of counters after applying all alternating operations: increase counter by 1; set value of all counters to current maximum.
Find the smallest positive integer that does not occur in a given sequence.
Count the number of passing cars on the road.
Compute number of integers divisible by k in range [a..b].
Find the minimal nucleotide from a range of sequence DNA.
Find the minimal average of any slice containing at least two elements.
Compute number of distinct values in an array.
Maximize A[P] * A[Q] * A[R] for any triplet (P, Q, R).
Compute the number of intersections in a sequence of discs.
Determine whether a given string of parentheses (single type) is properly nested.
Determine whether a given string of parentheses (multiple types) is properly nested.
Determine whether a given string of parentheses (single type) is properly nested.
Determine whether a given string of parentheses (single type) is properly nested.
N voracious fish are moving along a river. Calculate how many fish are alive.
Cover "Manhattan skyline" using the minimum number of rectangles.
Find the index S such that the leaders of the sequences A[0], A[1], ..., A[S] and A[S + 1], A[S + 2], ..., A[N - 1] are the same.
Find an index of an array such that its value occurs at more than half of indices in the array.
Given a log of stock prices compute the maximum possible earning.
Find a maximum sum of a compact subsequence of array elements.
Count factors of given number n.