Pergunta de entrevista da empresa Two Sigma

Two dynamic programming questions.