Yandex Interview Question

Problems on two pointers and trees