Pregunta de entrevista de Yandex

LeetCode medium question on binary tree