Pergunta de entrevista da empresa Amazon

A difficult question about binary trees