Pregunta de entrevista de Capital One

Binary tree question on leetcode