Uber Interview Question

One question on graphs and algorithm