Pergunta de entrevista da empresa Nagarro

Standard question of Dynamic Programming.