Pergunta de entrevista da empresa Gem

Basic DFS/BFS tree question involving recursion