Pregunta de entrevista de Google

question based on dynamic programming