Two Sigma Interview Question

Two dynamic programming questions.