← 返回 bytedance 的题目列表Find the Maximum Distance Between Two Nodes in a Custom Tree
类型:online_judge
Given a custom tree, define the tree node structure and find the maximum distance between any two nodes in the tree. The node structure can be freely designed but must include sufficient information to compute the distance. Implement a function to calculate and return the maximum distance. Test cases should include different structures and numbers of nodes.
Example
Input
Custom tree structure as input