Guided programming course

Our objective is to offer a series of hands-on coding lessons to everyone with basic programming knowledge and an interest in discovering the world of coding algorithms. Every lesson will provide you with programming tasks to help you discover the ins and outs of algorithms while coding for yourself.

 

We start with easy lessons to get everyone into shape for the later, more advanced lessons. The plan is to publish one or two lessons per month, running to about 35 in total. The result: you will end up loving programming and feeling empowered to tackle any technical recruitment challenge for yourself.

 

We plan to teach you about basic algorithms, data structures, number theory, methods of programming and graph and string algorithms. Hit us with your ideas and remarks here.


Lesson 1 – Time Complexity
*
TapeEquilibrium
Minimize the value |(A[0] + ... + A[P-1]) - (A[P] + ... + A[N-1])|.
*
FrogJmp
Count minimal number of jumps from position X to Y.
*
PermMissingElem
Find the missing element in a given permutation.

Lesson 2 – Counting Elements
*
PermCheck
Check whether array A is a permutation.
*
FrogRiverOne
Find the earliest time when a frog can jump to the other side of a river.
**
MaxCounters
Calculate the values of counters after applying all alternating operations: increase counter by 1; set value of all counters to current maximum.

Lesson 3 – Prefix Sums
*
PassingCars
Count the number of passing cars on the road.
**
GenomicRangeQuery
Find the minimal nucleotide from a range of sequence DNA.
**
MinAvgTwoSlice
Find the minimal average of any slice containing at least two elements.
**
CountDiv
Compute number of integers divisible by k in range [a..b].

Lesson 4 – Sorting
*
Distinct
Compute number of distinct values in an array.
*
MaxProductOfThree
Maximize A[P] * A[Q] * A[R] for any triplet (P, Q, R).
**
Triangle
Determine whether a triangle can be built from a given set of edges.
***
beta2010
Compute intersections between sequence of discs.

Lesson 5 – Stacks and Queues
*
Brackets
Determine whether a given string of parentheses is properly nested.
*
Nesting
Determine whether given string of parentheses is properly nested.
sigma2012
Cover "Manhattan skyline" using the minimum number of rectangles.
**
Fish
N voracious fish are moving along a river. Calculate how many fish are alive.

Lesson 6 – Leader
*
Dominator
Find an index of an array such that its value occurs at more than half of indices in the array.
*
EquiLeader
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.

Lesson 7 – Maximum slice problem
**
MaxDoubleSliceSum
Find the maximal sum of any double slice.
**
MaxProfit
Given a log of stock prices compute the maximum possible earning.
**
MaxSliceSum
Find a maximum sum of a compact subsequence of array elements.

Lesson 8 – Prime and composite numbers
*
MinPerimeterRectangle
Find the minimal perimeter of any rectangle whose area equals N.
**
Peaks
Divide an array into the maximum number of same((-))sized blocks, each of which should contain an index P such that A[P - 1] < A[P] > A[P + 1].
boron2013
Find the maximum number of flags that can be set on mountain peaks.

Lesson 9 – Sieve of Eratosthenes
**
CountNonDivisible
Calculate the number of elements of an array that are not divisors of each element.
**
CountSemiprimes
Count the semiprime numbers in the given range [a..b]

Lesson 10 – Euclidean algorithm
*
ChocolatesByNumbers
There are N chocolates in a circle. Count the number of chocolates you will eat.
**
CommonPrimeDivisors
Check whether two numbers have the same prime divisors.

Lesson 11 – Fibonacci numbers
**
FibFrog
Count the minimum number of jumps required for a frog to get to the other side of a river.
**
Ladder
Count the number of different ways of climbing to the top of a ladder.

Lesson 12 – Binary search algorithm
**
MinMaxDivision
Divide array A into K blocks and minimize the largest sum of any block.
**
NailingPlanks
Count the minimum number of nails that allow a series of planks to be nailed.

Lesson 13 – Caterpillar method
*
CountTriangles
Count the number of triangles that can be built from a given set of edges.
*
AbsDistinct
Compute number of distinct absolute values of sorted array elements.
**
CountDistinctSlices
Count the number of distinct slices (containing only unique numbers).
***
MinAbsSumOfTwo
Find the minimal absolute value of a sum of two elements.

Further training

All the tasks below (most of them former Codility challenges) are sorted by increasing level of difficulty.

 

*
BinaryGap
Find longest sequence of zeros in binary representation of an integer.
alpha2010
Given a table A of N integers from 0 to N-1 calculate the smallest such index P, that that {A[0],...,A[N-1]} = {A[0],...,A[P]}.
*
TreeHeight
Compute the height of a binary link-tree.
omega2013
Determine the number of disks that fit into the well.
**
ArrayInversionCount
Compute number of inversion in an array.
lithium2013
Find the maximal number of clocks with hands that look identical when rotated.
**
Equi
Find an index in an array such that its prefix sum equals its suffix sum.
psi2012
While removing edges from a mesh grid, find the moment when there ceases to be a connection between opposite corners.
pi2012
For each element of an array of integers, find the closest larger element.
***
zeta2011
Calculate how balls roll through a board of switches.
***
gamma2011
Count the palindromic subwords of given string.
chi2012
Simulate a cannon shooting and heaps of falling cannonballs
upsilon2012
Find the longest path down the Cartesian tree.
oxygenium2014
Calculate the number of slices in which (maximum - minimum <= K).
nu2011
Given two slices of sorted arrays, find the median. Repeat for many such slices, return the median of the results.
***
helium2013
Find the longest border of a given string, that has three non-overlapping occurrences.
omicron2012
Given integers A and B, calculate Fib(A ** B) % 10000103.
lambda2011
For each node in a tree find the sum of distances to all other nodes.
***
epsilon2011
Compute minimal value of the function (max f_n) - (min f_n).
xi2012
Count ints with each two consecutive 1s (in a binary representation) separated by at least K 0s.
hydrogenium2013
Find the shortest path in a weighted graph
***
eta2011
Check whether a given sequence is a valid traversal of some ternary undirected tree.
***
iota2011
Calculate the shortest adjacent sequence for given array A.
kappa2011
Find the number of different ways in which the space crew can be selected.
delta2011
Given array of integers, find the lowest absolute sum of elements.
***
carbo2013
Find the maximal product of string prefixes.
***
nitrogenium2013
Count the number of islands on consecutive days.
***
beryllium2013
Calculate the number of pairs (P, S) such that {A[0], ..., A[P]} = {A[S], ..., A[N-1]}.
***
theta2011
Calculate cheapest way of buying gas in order to drive along a highway.
***
neon2014
Connect N points with N line segments so as to minimize the largest distance between them.
mu2011
Compute total number of zeros in decimal representation of 1, ...., N.
rho2012
Find the shortest addition chain ending with a given integer.
phi2012
Count tilings of a narrow but long rectangle with tiles of size 1x1 or 2x2.
tau2012
Find a maximum-sum rectangular area in a matrix.
***
fluorum2014
Plan trips to destination cities so as to visit a maximal number of other unvisited cities en route.