Pergunta de entrevista da empresa Happay

Dsa question based on graph and trees