TikTok interview question

Hackerrank style OA, has 2 DP and Graph Leetcode hards.