Codingame exercise - http://www.codingame.com/cg/#!page:training