Yandex interview question

Tree traversal,zigzag iterator, merging intervals, perfect square