CSES Solutions - Tree Diameter
You are given a tree consisting of n nodes. The diameter of a tree is the maximum distance between two nodes. Your task is to determine the diameter of the tree. Examples: Input: n = 5, edges = { { 1, 2 }, { 1, 3 }, { 3, 4 }, { 3, 5 } };Output: 3 Input: n = 4, edges = { { 1, 2 }, { 1, 3 }, { 3, 4 }}