Nutanix Interview Question

Graph traversal problem.