Pergunta de entrevista da empresa 123RF.com

Is there a better way for this solution?