Adobe interview question

leetcode medium question on graphs