JPMorganChase Interview Question

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