Amazon Interview Question

I was asked question on dynamic programing