Diameter of an Undirected Graph
Asked at Amazon · Coding Questions · Difficulty: Medium
The diameter of an undirected graph is the length of the longest shortest path between any two nodes. Given `edges` (a list of node pairs), return the diameter (max over connected components).
Loading the problem…