Search⌘ K
AI Features

Solution: Tree Diameter

Solution: Tree Diameter gives an undirected tree as edges connecting labeled nodes. Return the number of edges on the longest path between any two nodes.

Statement

Given an undirected tree with nn nodes labeled from 00 to n−1n - 1, represented by a 2D array edges where edges.leng ...