Pregunta de entrevista de IBM

A coding question based on arrays.