Available question text
Given a rooted binary tree and m independent queries that remove the entire subtree rooted at a specified node (never the root), return the tree height after each removal. The core challenge is to preprocess depths and subtree heights (n up to 1e5, m up to 1e4) so you can compute each query’s new root-to-leaf longest path efficiently without recomputing the whole tree.
Related questions
Continue with questions that share topics or the same question type.
Sources · 1 reference
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 1 record
No company association
Leetcode 2458. Height of Binary Tree After Subtree Removal Queries
Reported date not specified · 0 source reports
Source snapshot: Nov 12, 2026
View source