Pregunta de entrevista de Two Sigma

Two dynamic programming questions.