Pregunta de entrevista de Amazon

Array question and hashmap question