Google Interview Question

probability and graph with depth first search.