Pergunta de entrevista da empresa Multiplier

A simple tree problem which can be solve using BFS, DFS