Domanda di colloquio di JPMorganChase

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