Meta interview question

Dynamic programming from leetcode website