Pergunta de entrevista da empresa Oracle

to find the maximum sum subtree, basically it was a graph problem