Domanda di colloquio di Givery

Graph question equivalent to leetcode hard