Apple interview question

Two leetcode dynamic programming questions