JPMorganChase interview question

two dynamic programming questions from leetcode. One easy and one medium