TikTok Interview Question

A leetcode medium, using graphs