Uber interview question

One question on graphs and algorithm