Pregunta de entrevista de Beyond Limits

An Easier Dynamic Programming question