Question d’entretien chez Google

Coding challenge had a dynamic programming problem.