Google interview question

A question on dynamic programming.