Nagarro Interview Question

Question on dynamic Programming