Solution to a Google Code Jam Practice Question.