Adding another interview question related to graph theory