Meta interview question

basic graph problem found on leetcode