Airbnb interview question

intermediate questions about graph, need to compile and run the code