Pergunta de entrevista da empresa ING

How would you solve this coding problem