Domanda di colloquio di Goldman Sachs

a question on dynamic programming and other on hashmap.