Verizon interview question

Dsa question on Dynamic Programming