NeetCode #469LC-1245MediumTrees
← Back to All Problems

#469 · #1245 · Tree Diameter(树的直径)

📌 Problem Statement & Constraints

Given an undirected tree represented as a list of edges, return its diameter: the number of edges on the longest path between any two nodes. Constraints: 1 <= number of nodes <= 10^4, edges.length == number of nodes - 1.
🔒

Sign In to Unlock Full Solutions for All 973 Problems

Sign in to access step-by-step logic, benchmark Python3 code, complexity breakdown, and offline export!