Google interview question

A simple dynamic programming problem.