Infosys interview question

Dynamic Programing Question 1D (DP)