Datadog interview question

40 minutes for two problems: Dynamic Programming question + DFS