I encountered an interesting problem based on tree-data-structure.
We are given a tree which has N nodes, with 1≤N≤105.