Solution to the Da Vyncy problem posted on CodeEval