Uber interview question

Round 1: graph based question, required knowledge of modified bfs.