Thales Interview Question

A graph traversal problem