Amazon Interview Question

I had a dynamic programming question