My C++ Solution
class Solution {\n    \n    public:\n        TreeNode* buildTree(vector<int>& inorder, vector<int>& postorder) {\n            \n            return helper(inorde
    class Solution {\n    \n    public:\n        TreeNode* buildTree(vector<int>& inorder, vector<int>& postorder) {\n            \n            return helper(inorder,0,inorder.size(),postorder,0,postorder.size());\n        }\n    private:\n        TreeNode* helper(vector<int>& inorder,int i,int j,vector<int>& postorder,int ii,int jj)\n        {\n            // \u6bcf\u6b21\u53d6postorder\u7684\u6700\u540e\u4e00\u4e2a\u503cmid\uff0c\u5c06\u5176\u4f5c\u4e3a\u6811\u7684\u6839\u8282\u70b9\n            // \u7136\u540e\u4eceinroder\u4e2d\u627e\u5230mid\uff0c\u5c06\u5176\u5206\u5272\u6210\u4e3a\u4e24\u90e8\u5206\uff0c\u5de6\u8fb9\u4f5c\u4e3amid\u7684\u5de6\u5b50\u6811\uff0c\u53f3\u8fb9\u4f5c\u4e3amid\u7684\u53f3\u5b50\u6811\n            // tree:     8 4 10 3 6 9 11\n            // Inorder   [3 4 6] 8 [9 10 11]\n            // postorder [3 6 4]   [9 11 10] 8\n    \n            if(i >= j || ii >= jj)\n                return NULL;\n            \n            int mid = postorder[jj - 1];\n            \n            auto f = find(inorder.begin() + i,inorder.begin() + j,mid);\n            \n            int dis = f - inorder.begin() - i;\n            \n            TreeNode* root = new TreeNode(mid);\n            root -> left = helper(inorder,i,i + dis,postorder,ii,ii + dis);\n            root -> right = helper(inorder,i + dis + 1,j,postorder,ii + dis,jj - 1);\n            \n            return root;\n            \n        }\n    };
[]