Pregunta de entrevista de Affirm

Basic binary tree question, average complexity.