Citadel interview question

Leetcode easy question for trees