Print Binary Tree Diameter Path
One natural approach goes as follows. Compute recursively for each node both the longest leaf-to-leaf path in the subtree rooted at the node, and the depth of the deepest leaf. From this information for the two children of a node you can compute the same information for the node itself. Once you have reached the root, you have obtained your answer.

The above only computes the length of the longest path, but you can actually extract the longest path itself from the data for each node. Details left to you.