Bloomberg Interview Question

Depth first search. It’s basically a leetcode question but they tweak the scenario a bit