NVIDIA interview question

How to solve a dynamic programming problem