Question d’entretien chez Google

One DSA question based on dynamic programming. Difficulty level -high