Pregunta de entrevista de Groupon

an intermediate dynamic programming question