Find diameter trail
This is a practice for tree function. It returns the diameter trail of a tree by traversing each node only one time. The process is similar to finding diameter. During traverse each node, keep track of the trail of from the furthest leaf to node itself. For the following tree, it should return the diameter trail 1,… Read More »