easy to understand, beats 95% in Python3
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```python3 []\n# Definition for a binary tree node.\n# class TreeNode:\n#     def __init__(self, val=0, left=None, right=None):\n#         self.val = val\n#         self.left = left\n#         self.right = right\nclass Solution:\n    def treeQueries(self, root: Optional[TreeNode], queries: List[int]) -> List[int]:\n        n = len(queries)\n        ans = [-1 for _ in range(n)] \n        \n        mp = {}\n        for i, query in enumerate(queries):\n            if query not in mp:\n                mp[query] = [i]\n            else:\n                mp[query].append(i)\n        \n        max_depth = [-1]\n        def travelLeft(root: Optional[TreeNode], lv: int):\n            if not root:\n                max_depth[0] = max(max_depth[0], lv - 1)\n                return\n            \n            if root.val in mp:\n                for i in mp[root.val]:\n                    ans[i] = max(ans[i], max_depth[0])\n                \n            travelLeft(root.left, lv + 1)\n            travelLeft(root.right, lv + 1) \n        \n        def travelRight(root: Optional[TreeNode], lv: int):\n            if not root:\n                max_depth[0] = max(max_depth[0], lv - 1)\n                return\n            \n            if root.val in mp:\n                for i in mp[root.val]:\n                    ans[i] = max(ans[i], max_depth[0])\n                \n            travelRight(root.right, lv + 1)\n            travelRight(root.left, lv + 1)\n        \n        travelLeft(root, 0)\n        max_depth[0] = -1 \n        travelRight(root, 0)\n\n        for i in range(n):\n            if ans[i] == -1:\n                ans[i] = max_depth[0]\n\n        return ans\n```
['Tree', 'Python3']