123RF.com interview question

Is there a better way for this solution?