Pergunta de entrevista da empresa PDT Partners

A problem related with dynamic programming.