Pregunta de entrevista de Uber

Question on Dynamic Programming