Google Interview Question

technical interview - graph problem