Domanda di colloquio di Genesys

LC medium level graph theory problem. JavaScript or Java only.