Re: [闲聊] 每日leetcode

楼主: dont   2024-10-26 10:05:10
2458. Height of Binary Tree After Subtree Removal Queries
## 思路
DFS 记录删掉node之后的height
max(curr_max, depth + sibling height)
e.g.
1
2 3
4 5
6
删掉3的高度 = 4 [1,2,5,6]

Links booklink

Contact Us: admin [ a t ] ucptt.com