Pergunta de entrevista da empresa Oracle

A question about valid binary tree structure.