Duolingo Interview Question

2 questions, one DP leetcode hard and one graph.