hihoweek11 unfollow

Hiho! is a serial contests we developed to help programmers improve their skills following some architecture. Tree, as a data struct, its most significant feature is that it can be divide in to several problem simply by its natural form, which it's similar to what we have told in "Dynamic Programming".

And this week, we will talk about a basic but typical problem in "Tree" - "The longest path in tree" or "Diameter of tree", you maybe know the way to solve it by calculate the longest path from one node and the calculate it again from the destination, but do you know a graceful way to solve it by recursion?