X Interview Question

A graph related algorithm question