Domanda di colloquio di Media.net

One question on simple implementation on dynamic programming.