Affirm interview question

Basic binary tree question, average complexity.