DMS two times
Intuition\nsource:0x3f\n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time complexity:O(n)\n Add your time complexity here, 
# Intuition\nsource:0x3f\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:O(n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:O(n)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\n/**\n * Definition for a binary tree node.\n * type TreeNode struct {\n *     Val int\n *     Left *TreeNode\n *     Right *TreeNode\n * }\n */\nfunc treeQueries(root *TreeNode, queries []int) []int {\n    height:=map[*TreeNode]int{}//tree node height\n    var dfsheight func(*TreeNode)int\n    dfsheight=func(node *TreeNode) int{\n        if node==nil{\n            return 0\n        }\n        height[node]=max(dfsheight(node.Left),dfsheight(node.Right))+1\n        return height[node]\n    }\n    dfsheight(root)\n\n    ans:=make([]int,len(height)+1)\n    var dfs func(*TreeNode,int,int)\n    dfs=func(node *TreeNode,deep,val int){\n        if node==nil{\n            return\n        }\n        deep+=1\n        ans[node.Val]=val\n        dfs(node.Left,deep,max(val,height[node.Right]+deep-1))\n        dfs(node.Right,deep,max(val,height[node.Left]+deep-1))\n    }\n    dfs(root,0,0)\n\n    for i,v := range(queries){\n        queries[i]=ans[v]\n    }\n    return queries\n}\nfunc max(a,b int)int{if a>b {return a}; return b}\n```
['Go']