Bloomberg Interview Question

String check. DFS graph traversal.