Solution to Facbook's sample hiring test problem.