...

/

Solution: Tree Diameter

Solution: Tree Diameter

Let’s solve the Tree Diameter problem using the Graphs pattern.

Statement

Given an undirected tree with nn nodes labeled from 00 to n1n - 1, represented by a 2D array edges where edges.length==n1edges.length == n - 1. Each edges[i]=[ai,bi]edges[i] = [a_i, b_i] ...