Pony.ai Interview Question

a DFS problem