Capital One interview question

Binary tree question on leetcode