Pregunta de entrevista de Amazon

to fix a code, whose have a logical error.