Sumo Logic interview question

Tree Camera Problem from Leetcode