Pergunta de entrevista da empresa RepUp

Coding question was on dynamic programming