Numbrs Interview Question

Dynamic programming hacker rank question.