AT&T Interview Question

One of the questions required dynamic programming.