Concept Flow - DP on Trees Diameter of Tree
Start at any node
DFS to children
Compute max depths from children
Update diameter using top two depths
Return max depth to parent
Repeat for all nodes
Final diameter is max found
We start DFS from any node, compute max depths from children, update diameter using top two depths, and return max depth to parent until all nodes are processed.