O(n) recursive solution without hashmap nor index
python solution:\npython\nclass Solution(object):\n    def buildTree(self, inorder, postorder):\n        """\n        :type inorder: List[int]\n        :type po
python solution:\n```python\nclass Solution(object):\n    def buildTree(self, inorder, postorder):\n        """\n        :type inorder: List[int]\n        :type postorder: List[int]\n        :rtype: TreeNode\n        """\n        def postdfs(stop):\n            if postorder and inorder[-1] != stop:\n                root = TreeNode(postorder.pop())\n                root.right = postdfs(root.val)\n                inorder.pop()\n                root.left = postdfs(stop)\n                return root\n        inorder, postorder = inorder[:], postorder[:]\n        return postdfs(None)\n\n# 202 / 202 test cases passed.\n# Status: Accepted\n# Runtime: 62 ms\n# beats 97.20 %\n```\nc++ solution:\n```\n/**\n * Definition for a binary tree node.\n * struct TreeNode {\n *     int val;\n *     TreeNode *left;\n *     TreeNode *right;\n *     TreeNode(int x) : val(x), left(NULL), right(NULL) {}\n * };\n */\nclass Solution {\npublic:\n    TreeNode* buildTree(vector<int>& inorder, vector<int>& postorder) {\n        vector<int> in(inorder), post(postorder);\n        return postdfs(in, post, (TreeNode *)NULL);\n    }\n\n    TreeNode * postdfs(vector<int> & in, vector<int> & post, TreeNode * stop) {\n        if ( post.empty() || (stop && in.back() == stop->val) ) {\n            return NULL;\n        }\n        TreeNode * root = new TreeNode(post.back());\n        post.pop_back();\n        root->right = postdfs(in, post, root);\n        in.pop_back();\n        root->left = postdfs(in, post, stop);\n        return root;\n    }\n};\n\n// 202 / 202 test cases passed.\n// Status: Accepted\n// Runtime: 9 ms\n// beats 91.06 %\n```
['Depth-First Search', 'C', 'Python']