A solution for a coding test.