Diameter of Binary Tree — Interactive Visualizer

DFS computing height while tracking max left+right height across all nodes to find the longest path.