Pregunta de entrevista de Datadog

Binary tree question which was somewhat basic