Pregunta de entrevista de Amazon

array and followup questions about optimizing your solution