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