very easy code using reccursion concept
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```cpp []\nclass Solution {\npublic:\n    int max_height_after_removal[100001];\n    int current_max_height = 0;\n\n    vector<int> treeQueries(TreeNode* root, vector<int>& queries) {\n        traverse_left_to_right(root, 0);\n        current_max_height = 0;\n        traverse_right_to_left(root, 0);\n\n        vector<int> query_results(queries.size());\n        for (int i = 0; i < queries.size(); i++) \n            query_results[i] = max_height_after_removal[queries[i]];\n\n        return query_results;\n    }\n\nprivate:\n    void traverse_left_to_right(TreeNode* node, int height) {\n        if (node == nullptr) return;\n\n        max_height_after_removal[node->val] = current_max_height;\n        current_max_height = max(current_max_height, height);\n\n        traverse_left_to_right(node->left, height + 1);\n        traverse_left_to_right(node->right, height + 1);\n    }\n\n    void traverse_right_to_left(TreeNode* node, int height) {\n        if (node == nullptr) return;\n\n        max_height_after_removal[node->val] = max(max_height_after_removal[node->val], current_max_height);\n        current_max_height = max(current_max_height, height);\n\n        traverse_right_to_left(node->right, height + 1);\n        traverse_right_to_left(node->left, height + 1);\n    }\n};\n\n```
['C++']