Anonymous Interview Question

dynamic programming problem with a twist