Pregunta de entrevista de Winton Group

Binary Trees question on Codility