Pregunta de entrevista de ING

How would you solve this coding problem