Daily challenge for 2026-01-19
384. Find Rooted Tree Diameter Path
Given a tree represented by an adjacency list where each edge has a weight of 1 (unweighted graph), find the length of the longest path between any two nodes (the diameter). The input is an array of edges. Assume the graph is connected and acyclic (a tree).
Example:Input: n = 5, edges = [[0, 1], [1, 2], [1, 3], [3, 4]]Output: 3 (Path 2-1-3-4 or 0-1-3-4)
Run this challenge interactively in Python or JavaScript when the app loads.