Pregunta de entrevista de Mars

How would you approach this specific problem?