Pregunta de entrevista de Amazon

How would you approach this problem