Solution to CodeEval Questions