Airbnb Interview Question

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