Tree-Diameter
LeetCode 3203: Find Minimum Diameter After Merging Two Trees
·3 mins
LeetCode
Hard
Tree
Bfs
Dfs
Graph
Tree-Diameter
LeetCode 3203 note: connect the two centers; the answer is max(d1, d2, ceil(d1/2) + ceil(d2/2) + 1)
LeetCode 3313: Find the Last Marked Nodes in Tree
·2 mins
LeetCode
Hard
Tree
Bfs
Graph
Tree-Diameter
LeetCode 3313 note: the last marked node is the farthest one, and a farthest node can always be a diameter endpoint