AT&T interview question

One of the questions required dynamic programming.