Meituan Interview Question

A complex binary tree question.