Pergunta de entrevista da empresa Palantir Technologies

Algorithm question using tree data structure