Search
⌘K

Leetcode 1245. Tree Diameter

Given an undirected tree, find its diameter — the maximum distance (sum of edge weights, or number of edges if unweighted) along any simple path between two nodes. This is typically solved with tree traversals (e.g., two BFS/DFS passes or tree DP) to compute farthest-node distances.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.