Pregunta de entrevista de Amazon

about optimization the code they need optimal one