Pregunta de entrevista de Amazon

Basic coding with follow up questions.