Motadata interview question

There was some tree algorithm which I couldn't solve or understand