Question d’entretien chez Google

DSA tree question, medium-hard leetcode difficulty.