Amazon interview question

A challenging dynamic programming question.