simple JavaScript solution using DFS
javascript\n/**\n * @param {number[]} inorder\n * @param {number[]} postorder\n * @return {TreeNode}\n */\nvar buildTree = function(inorder, postorder) {\n  ret
```javascript\n/**\n * @param {number[]} inorder\n * @param {number[]} postorder\n * @return {TreeNode}\n */\nvar buildTree = function(inorder, postorder) {\n  return dfs(inorder.length - 1, 0, inorder.length - 1);\n\n  function dfs(index, startPos, endPos) {\n    if (startPos > endPos)\n      return null;\n\n    var node = new TreeNode(postorder[index]);\n    var pos = inorder.indexOf(postorder[index]);\n\n    node.left = dfs(index - (endPos - pos) - 1, startPos, pos - 1);\n    node.right = dfs(index - 1, pos + 1, endPos);\n\n    return node;\n  }\n};\n```\n\nall my leetcode solutions are here <https://github.com/hanzichi/leetcode>, give me a star if you like it!
[]