Google Interview Question

Two dynamic programming questions. One is easy, the other is hard.