Bloomberg Interview Question

LeetCode graph question: traverse using recursion and make sure you don’t get stuck in a loop.