AKUNA CAPITAL interview question

Algorithms questions, mostly basic graph theory. My implementation was essentially DFS