Nykaa interview question

Dynamic Programming basic easy problem.